2 #include "libpbd-config.h"
5 #ifndef HAVE_LOCALTIME_R
9 #include "pbd/pthread_utils.h"
10 #include "pbd/localtime_r.h"
17 localtime_r(const time_t *const timep, struct tm *p_tm)
19 static pthread_mutex_t time_mutex;
20 static int time_mutex_inited = 0;
23 if (!time_mutex_inited)
25 time_mutex_inited = 1;
26 pthread_mutex_init(&time_mutex, NULL);
29 pthread_mutex_lock(&time_mutex);
30 tmp = localtime(timep);
33 memcpy(p_tm, tmp, sizeof(struct tm));
36 pthread_mutex_unlock(&time_mutex);
45 __cdecl localtime(const long int *_Time)
49 return localtime((const time_t *const)NULL); // Unpredictable behavior in case of _Time == NULL;
53 const time_t tempTime = *_Time;
54 return localtime(&tempTime);