From: Jeff Furlong Date: Thu, 14 Dec 2017 01:19:09 +0000 (+0000) Subject: Fix Windows local time X-Git-Tag: fio-3.3~11 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=7ff0297f39d0dea72a9b004393ca3c5e5f397760 Fix Windows local time 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 --- diff --git a/os/windows/posix.c b/os/windows/posix.c index 00f03355..17e18a1f 100755 --- a/os/windows/posix.c +++ b/os/windows/posix.c @@ -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)