I've attached a couple of patches contributed by Josh Sinykin. -- Bruce
From 2283b843f49513c3251e90dbf530962af70e5c62 Mon Sep 17 00:00:00 2001 From: Josh Sinykin <josh.sinykin@xxxxxxxxxxxx> Date: Mon, 19 Sep 2016 04:25:02 +0100 Subject: [PATCH] Fix garbage characters in json output caused by time_buf being uninitialized --- stat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stat.c b/stat.c index 74c2686..c9148ad 100644 --- a/stat.c +++ b/stat.c @@ -669,6 +669,8 @@ static void show_thread_status_normal(struct thread_stat *ts, if (!ddir_rw_sum(ts->io_bytes) && !ddir_rw_sum(ts->total_io_u)) return; + + memset(time_buf, 0, sizeof(time_buf)); time(&time_p); os_ctime_r((const time_t *) &time_p, time_buf, sizeof(time_buf)); -- 2.9.3.windows.2
From f16e4ba86753839f907ececce7684d60e8e3e2ca Mon Sep 17 00:00:00 2001 From: Josh Sinykin <josh.sinykin@xxxxxxxxxxxx> Date: Mon, 19 Sep 2016 04:17:30 +0100 Subject: [PATCH] Windows: fix Time_tToSystemTime function to be 64-bit compliant Use LONGLONG instead of LARGE_INTEGER to avoid problems on 64-bit systems causing a crash. --- os/windows/posix.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/os/windows/posix.c b/os/windows/posix.c index fd3d9ab..5830e4c 100755 --- a/os/windows/posix.c +++ b/os/windows/posix.c @@ -232,10 +232,12 @@ char *dlerror(void) /* Copied from http://blogs.msdn.com/b/joshpoley/archive/2007/12/19/date-time-formats-and-conversions.aspx */ void Time_tToSystemTime(time_t dosTime, SYSTEMTIME *systemTime) { - LARGE_INTEGER jan1970FT; - LARGE_INTEGER utcFT; - jan1970FT.QuadPart = 116444736000000000LL; // january 1st 1970 - utcFT.QuadPart = ((unsigned __int64)dosTime) * 10000000 + jan1970FT.QuadPart; + FILETIME utcFT; + LONGLONG jan1970; + + jan1970 = Int32x32To64(dosTime, 10000000) + 116444736000000000; + utcFT.dwLowDateTime = (DWORD)jan1970; + utcFT.dwHighDateTime = jan1970 >> 32; FileTimeToSystemTime((FILETIME*)&utcFT, systemTime); } -- 2.9.3.windows.2