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://firstname.lastname@example.org/msg18446.html, http://email@example.com/msg18453.html). However, since at least MVSCRT 2005, the native Windows functions have been thread safe. See:
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__.
Log in to post a comment.