From: Gabriel Ivăncescu gabrielopcode@gmail.com
Otherwise the division would be signed, while the input is an unsigned value. Also, cast the result to signed type before converting to double, since it can be negative then (e.g. if system clock is set before 1970).
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/date.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c index bc09f05d4b9..40b3df60b74 100644 --- a/dlls/jscript/date.c +++ b/dlls/jscript/date.c @@ -406,12 +406,12 @@ static inline DOUBLE time_clip(DOUBLE time) static double date_now(void) { FILETIME ftime; - LONGLONG time; + ULONGLONG time;
GetSystemTimeAsFileTime(&ftime); - time = ((LONGLONG)ftime.dwHighDateTime << 32) + ftime.dwLowDateTime; + time = ((ULONGLONG)ftime.dwHighDateTime << 32) + ftime.dwLowDateTime;
- return time/10000 - TIME_EPOCH; + return (LONGLONG)(time/10000) - (LONGLONG)TIME_EPOCH; }
static SYSTEMTIME create_systemtime(DOUBLE time)