aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-11-27 14:50:44 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2023-11-28 10:22:16 +0000
commit68eceb3049741001c63d0c3d6a17a76ab2bf0af0 (patch)
tree5240bfc9766157a8d8333c8513377d7654fccb99
parent50089de3e80a9ee0e52b253a3456c64c560171ef (diff)
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 <ABBAPOH@gmail.com>
-rw-r--r--src/shared/quickjs/quickjs.c3
1 files changed, 2 insertions, 1 deletions
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);