]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Use _localtime32() instead of localtime() on Windows
authorRamiro Polla <ramiro.polla@gmail.com>
Fri, 16 Jul 2010 19:57:42 +0000 (16:57 -0300)
committerRamiro Polla <ramiro.polla@gmail.com>
Fri, 16 Jul 2010 19:57:42 +0000 (16:57 -0300)
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

diff --git a/util.c b/util.c
index 61fb541bebf7cde7ea0b5d3e73b34eef7ad58ebb..f887ed02b3f1fdb29fa2dc2187a5e66868cbce7f 100644 (file)
--- 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());