diff --git a/src/debug.c b/src/debug.c index 70fc6acc0..1aacbb56d 100644 --- a/src/debug.c +++ b/src/debug.c @@ -150,10 +150,12 @@ char *date_strget(char *buf, int buflen) { char tmp[16]; struct tm *mytm; + time_t t; struct timeval tv; - gettimeofday(&tv, NULL); - mytm = gmtime(&tv.tv_sec); + t = time(NULL); + mytm = gmtime(&t); strftime(buf, buflen, "%Y-%m-%d:%H:%M:%S.", mytm); + gettimeofday(&tv, NULL); sprintf(tmp, "%06ld", (long)tv.tv_usec); strcat(buf, tmp); return buf;