OSDN Git Service

w64: Fix time conversion for some versions of MinGW-w64
authorStefan Weil <sw@weilnetz.de>
Thu, 12 Apr 2012 20:33:12 +0000 (22:33 +0200)
committerStefan Weil <sw@weilnetz.de>
Sun, 15 Apr 2012 19:25:18 +0000 (21:25 +0200)
tb.time is a time value, but not necessarily of the same size as time_t:
while time_t is 64 bit for w64, tb.time still is 32 bit only.

Therefore we need en explicit conversion.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
savevm.c

index 12fb209..2d18bab 100644 (file)
--- a/savevm.c
+++ b/savevm.c
@@ -2106,7 +2106,8 @@ void do_savevm(Monitor *mon, const QDict *qdict)
         }
     } else {
 #ifdef _WIN32
-        ptm = localtime(&tb.time);
+        time_t t = tb.time;
+        ptm = localtime(&t);
         strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", ptm);
 #else
         /* cast below needed for OpenBSD where tv_sec is still 'long' */