Fix Windows local time
authorJeff Furlong <jeff.furlong@wdc.com>
Thu, 14 Dec 2017 01:19:09 +0000 (01:19 +0000)
committerJens Axboe <axboe@kernel.dk>
Thu, 14 Dec 2017 16:10:12 +0000 (09:10 -0700)
The fio summary output shows when the job completed, but references
system time on Windows.  On Linux, local time (such as with time zone
specifics) is referenced.  This patch converts Windows system time to
local time.

Before:
fio-3.2-72-ge80d-dirty
Starting 1 thread
Jobs: 1 (f=0): [f(1)][100.0%][r=69.6MiB/s,w=0KiB/s][r=17.8k,w=0 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=1360: Wed Dec 13 23:21:16 2017 <--System Time

After:
fio-3.2-72-ge80d-dirty
Starting 1 thread
Jobs: 1 (f=0): [f(1)][100.0%][r=73.2MiB/s,w=0KiB/s][r=18.7k,w=0 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=8088: Wed Dec 13 15:22:07 2017 <--Local Time

Signed-off-by: Jens Axboe <axboe@kernel.dk>
os/windows/posix.c

index 00f03355985077c08665a79e5036b60755507e40..17e18a1f77edef85a6a00f5eef8ac44fcea30ec8 100755 (executable)
@@ -228,12 +228,14 @@ void Time_tToSystemTime(time_t dosTime, SYSTEMTIME *systemTime)
 {
     FILETIME utcFT;
     LONGLONG jan1970;
+       SYSTEMTIME tempSystemTime;
 
     jan1970 = Int32x32To64(dosTime, 10000000) + 116444736000000000;
     utcFT.dwLowDateTime = (DWORD)jan1970;
     utcFT.dwHighDateTime = jan1970 >> 32;
 
-    FileTimeToSystemTime((FILETIME*)&utcFT, systemTime);
+    FileTimeToSystemTime((FILETIME*)&utcFT, &tempSystemTime);
+       SystemTimeToTzSpecificLocalTime(NULL, &tempSystemTime, systemTime);
 }
 
 char* ctime_r(const time_t *t, char *buf)