summaryrefslogtreecommitdiff
path: root/os/windows
diff options
context:
space:
mode:
authorJosh Sinykin <josh.sinykin@broadcom.com>2016-09-19 04:17:30 +0100
committerJens Axboe <axboe@fb.com>2016-09-19 08:28:11 -0600
commit5de1ade5a8a8dd118bdfac835a6cfb4bcf013734 (patch)
tree8a9e04625eaa0b03b1e57354c30345f045256c67 /os/windows
parent33477b4b5f61c2ba57bc3346b8968d9be8b56fc4 (diff)
downloadfio-5de1ade5a8a8dd118bdfac835a6cfb4bcf013734.tar.gz
fio-5de1ade5a8a8dd118bdfac835a6cfb4bcf013734.tar.bz2
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. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'os/windows')
-rwxr-xr-xos/windows/posix.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/os/windows/posix.c b/os/windows/posix.c
index fd3d9ab3..5830e4c4 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);
}