/* */ #include #ifdef __MINGW32__ #include #endif // __MINGW32__ #include "localtime_r.h" struct tm * localtime_r(const time_t *clock, struct tm *result) { static struct tm *local_tm; #ifdef __MINGW32__ static CRITICAL_SECTION cs; static int initialized = 0; if (!initialized) { ++initialized; InitializeCriticalSection(&cs); } EnterCriticalSection(&cs); local_tm = localtime(clock); memcpy(result, local_tm, sizeof(struct tm)); LeaveCriticalSection(&cs); #endif // __MINGW32__ return result; };