From: Ramiro Polla Date: Fri, 16 Jul 2010 19:57:42 +0000 (-0300) Subject: Use _localtime32() instead of localtime() on Windows X-Git-Tag: v3.1~167^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d06c5fd0488c705aae1abc1b38d46ea1e9b0131e;p=thirdparty%2Fccache.git 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. --- 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());