From 6db07f1cba4cfd701733ad971df6260e476b447b Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 20 Dec 2008 16:09:49 +0000 Subject: [PATCH] [SIGAR-129] fix possible integer overflow in time_now_millis --- src/os/win32/win32_sigar.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c index c0593f12..fdc7d0c0 100644 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -1254,11 +1254,13 @@ SIGAR_DECLARE(int) sigar_proc_cred_get(sigar_t *sigar, sigar_pid_t pid, sigar_int64_t sigar_time_now_millis(void) { + SYSTEMTIME st; FILETIME time; - GetSystemTimeAsFileTime(&time); + GetSystemTime(&st); + SystemTimeToFileTime(&st, &time); - return FILETIME2MSEC(time); + return sigar_FileTimeToTime(&time) / 1000; } SIGAR_DECLARE(int) sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,