Menu

#1625 gmtime_r omitted in pthread.h

MSYS
open
gcc (462)
Bug
none
Unknown
False
2014-08-16
2012-02-16
No

The macros for 'gmtime_r', et al, were removed from 'pthread.h when the Pthreads32 library was incorporated into MinGW, in the mistaken belief that they were "broken" (see http://www.mail-archive.com/bug-gnulib@gnu.org/msg18446.html, http://www.mail-archive.com/bug-gnulib@gnu.org/msg18453.html). However, since at least MVSCRT 2005, the native Windows functions have been thread safe. See:

http://sources.redhat.com/ml/pthreads-win32/2005/msg00011.html
http://msdn.microsoft.com/en-us/library/bf12f0hc%28VS.80%29.aspx

In the second reference, MSDN says "Both the 32-bit and 64-bit versions of gmtime, mktime, mkgmtime, and localtime all use a single tm structure per thread for the conversion. Each call to one of these routines destroys the result of the previous call."

So at the very least, the macros should be included with conditionals using __MSVCRT_VERSION__.

Discussion

  • Earnie Boyd

    Earnie Boyd - 2012-06-14

    pthread.h is part of GCC, assigning to Cesar for follow up.

     
  • Earnie Boyd

    Earnie Boyd - 2012-06-14
    • labels: 103945 --> gcc
    • assigned_to: nobody --> cstrauss
     
  • Earnie Boyd

    Earnie Boyd - 2013-02-11
    • milestone: --> MSYS
    • type: --> Bug
    • resolution: --> none
    • category: --> Unknown
    • patch_attached: --> False
     
  • The_NetZ

    The_NetZ - 2014-06-09

    I'm still having related issues to this, I think.
    Compiling a simple program,

    #include "string" //had to quote to make it show up.
    #include "ruby.h"
    int main() {
      return(0);
    }
    

    yields the following output:
    https://gist.githubusercontent.com/ntzrmtthihu777/1c7eb399749bce88b53c/raw/g++.log
    Hope this gets settled soonish, and I'd be glad to help out if I can :P

     

    Last edit: The_NetZ 2014-06-09