From d06c5fd0488c705aae1abc1b38d46ea1e9b0131e Mon Sep 17 00:00:00 2001 From: Ramiro Polla Date: Fri, 16 Jul 2010 16:57:42 -0300 Subject: [PATCH] Use _localtime32() instead of localtime() on Windows The gettimeofday() function provided by libmingwex.a hasn't been implemented for 64-bit yet, so the data it returns should always be passed to the 32-bit localtime function. --- util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util.c b/util.c index 61fb541be..f887ed02b 100644 --- a/util.c +++ b/util.c @@ -77,7 +77,11 @@ static void log_prefix(void) struct tm *tm; gettimeofday(&tv, NULL); +#ifdef _WIN32 + tm = _localtime32(&tv.tv_sec); +#else tm = localtime(&tv.tv_sec); +#endif strftime(timestamp, sizeof(timestamp), "%Y-%m-%dT%H:%M:%S", tm); fprintf(logfile, "[%s.%06d %-5d] ", timestamp, (int)tv.tv_usec, (int)getpid()); -- 2.47.3