[SIGAR-129] fix possible integer overflow in time_now_millis

This commit is contained in:
Doug MacEachern 2008-12-20 16:09:49 +00:00
parent ede7b6c9de
commit 6db07f1cba
1 changed files with 4 additions and 2 deletions

View File

@ -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) sigar_int64_t sigar_time_now_millis(void)
{ {
SYSTEMTIME st;
FILETIME time; 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, SIGAR_DECLARE(int) sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,