{
const char *cp;
time_t val, now = time(NULL);
- struct tm t, *today = localtime(&now);
+ struct tm t, tmp, *today = localtime_r(&now, &tmp);
int in_date, old_mday, n;
memset(&t, 0, sizeof t);
{
if (t) {
int len;
- struct tm *mt = gmtime(&t);
+ struct tm tmp, *mt = gmtime_r(&t, &tmp);
len = snprintf(dest, destsize,
" %04d-%02d-%02d %02d:%02d:%02d",
static int ndx = 0;
static char buffers[4][20]; /* We support 4 simultaneous timestring results. */
char *TimeBuf = buffers[ndx = (ndx + 1) % 4];
- struct tm *tm = localtime(&t);
+ struct tm tmp, *tm = localtime_r(&t, &tmp);
int len = snprintf(TimeBuf, sizeof buffers[0], "%4d/%02d/%02d %02d:%02d:%02d",
(int)tm->tm_year + 1900, (int)tm->tm_mon + 1, (int)tm->tm_mday,
(int)tm->tm_hour, (int)tm->tm_min, (int)tm->tm_sec);