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__.
pthread.h is part of GCC, assigning to Cesar for follow up.
I'm still having related issues to this, I think.
Compiling a simple program,
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