X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fgenstamp.c;fp=citadel%2Fgenstamp.c;h=e97fb97963fac9084ed1650310851009e73a5757;hb=c7209f051c44912da2e367e984a8c8660b9139d2;hp=09fe1946957e645a249d391160de2badcf47ada4;hpb=8b4ca15e5a73286ca213a11e1e11400b1a222e99;p=citadel.git diff --git a/citadel/genstamp.c b/citadel/genstamp.c index 09fe19469..e97fb9796 100644 --- a/citadel/genstamp.c +++ b/citadel/genstamp.c @@ -44,16 +44,16 @@ static char *weekdays[] = { * time and date stamp. */ void datestring(char *buf, size_t n, time_t xtime, int which_format) { - struct tm *t; + struct tm t; long offset; char offsign; - t = localtime(&xtime); + localtime_r(&xtime, &t); /* Convert "seconds west of GMT" to "hours/minutes offset" */ #ifdef HAVE_STRUCT_TM_TM_GMTOFF - offset = t->tm_gmtoff; + offset = t.tm_gmtoff; #else offset = timezone; #endif @@ -70,25 +70,25 @@ void datestring(char *buf, size_t n, time_t xtime, int which_format) { case DATESTRING_RFC822: snprintf(buf, n, "%s, %02d %s %04d %02d:%02d:%02d %c%04ld", - weekdays[t->tm_wday], - t->tm_mday, - months[t->tm_mon], - t->tm_year + 1900, - t->tm_hour, - t->tm_min, - t->tm_sec, + weekdays[t.tm_wday], + t.tm_mday, + months[t.tm_mon], + t.tm_year + 1900, + t.tm_hour, + t.tm_min, + t.tm_sec, offsign, offset ); break; case DATESTRING_IMAP: snprintf(buf, n, "%02d-%s-%04d %02d:%02d:%02d %c%04ld", - t->tm_mday, - months[t->tm_mon], - t->tm_year + 1900, - t->tm_hour, - t->tm_min, - t->tm_sec, + t.tm_mday, + months[t.tm_mon], + t.tm_year + 1900, + t.tm_hour, + t.tm_min, + t.tm_sec, offsign, offset ); break;