From 68eceb3049741001c63d0c3d6a17a76ab2bf0af0 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 27 Nov 2023 14:50:44 +0100 Subject: quickjs: Fix current date on Windows Microsoft's baseline is a couple of hundred years before Unix's. Fixes: QBS-1768 Change-Id: I1845036b59665cbc1640887840a7d03edbc0cb54 Reviewed-by: Ivan Komissarov --- src/shared/quickjs/quickjs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/quickjs/quickjs.c b/src/shared/quickjs/quickjs.c index 61b9816e7..1e3b97d51 100644 --- a/src/shared/quickjs/quickjs.c +++ b/src/shared/quickjs/quickjs.c @@ -42103,6 +42103,7 @@ static JSValue js___date_now(JSContext *ctx, JSValueConst this_val, #endif /* OS dependent: return the UTC time in microseconds since 1970. */ +// FIXME: Unused, remove? static JSValue js___date_clock(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { @@ -48332,7 +48333,7 @@ static int64_t date_now(void) { GetSystemTime(&st); int64_t d; SystemTimeToFileTime(&st, (FILETIME *) &d); - return d /= 10000; + return (d - 116444736000000000ULL) / 10000; #else struct timeval tv; gettimeofday(&tv, NULL); -- cgit v1.2.3