Fixed seconds logging

This commit is contained in:
Michiel Broek 2005-08-30 19:03:51 +00:00
parent 757de0c8fa
commit cd3320d1b1

View File

@ -67,7 +67,7 @@ char *date(void)
{ {
struct tm ptm; struct tm ptm;
time_t now; time_t now;
static char buf[20]; static char buf[21];
now = time(NULL); now = time(NULL);
#if defined(__OpenBSD__) #if defined(__OpenBSD__)
@ -75,7 +75,7 @@ char *date(void)
#else #else
ptm = *localtime(&now); ptm = *localtime(&now);
#endif #endif
snprintf(buf, 20, "%02d-%s-%04d %02d:%02d:%02d", ptm.tm_mday, mon[ptm.tm_mon], ptm.tm_year+1900, snprintf(buf, 21, "%02d-%s-%04d %02d:%02d:%02d", ptm.tm_mday, mon[ptm.tm_mon], ptm.tm_year+1900,
ptm.tm_hour, ptm.tm_min, ptm.tm_sec); ptm.tm_hour, ptm.tm_min, ptm.tm_sec);
return(buf); return(buf);
} }
@ -85,14 +85,14 @@ char *date(void)
char *rfcdate(time_t now) char *rfcdate(time_t now)
{ {
struct tm ptm; struct tm ptm;
static char buf[20]; static char buf[21];
#if defined(__OpenBSD__) #if defined(__OpenBSD__)
localtime_r(&now, &ptm); localtime_r(&now, &ptm);
#else #else
ptm = *localtime(&now); ptm = *localtime(&now);
#endif #endif
snprintf(buf, 20, "%02d-%s-%04d %02d:%02d:%02d", ptm.tm_mday, mon[ptm.tm_mon], ptm.tm_year+1900, snprintf(buf, 21, "%02d-%s-%04d %02d:%02d:%02d", ptm.tm_mday, mon[ptm.tm_mon], ptm.tm_year+1900,
ptm.tm_hour, ptm.tm_min, ptm.tm_sec); ptm.tm_hour, ptm.tm_min, ptm.tm_sec);
return(buf); return(buf);
} }