From 78c9676111306e777cdcdfbce526179f20c562e1 Mon Sep 17 00:00:00 2001 From: geequlim Date: Sat, 11 Jul 2020 22:19:56 +0800 Subject: [PATCH] Using DOMHighResTimeStamp value for requestAnimationFrame --- quickjs/quickjs_binder.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quickjs/quickjs_binder.cpp b/quickjs/quickjs_binder.cpp index 815b38d7..3bbae397 100644 --- a/quickjs/quickjs_binder.cpp +++ b/quickjs/quickjs_binder.cpp @@ -1311,7 +1311,8 @@ void QuickJSBinder::frame() { while (id) { const ECMAScriptGCHandler &func = frame_callbacks.get(*id); JSValueConst js_func = JS_MKPTR(JS_TAG_OBJECT, func.ecma_object); - JSValue argv[] = { JS_NewInt64(ctx, (int64_t)OS::get_singleton()->get_system_time_msecs()) }; + double timestamp = OS::get_singleton()->get_ticks_usec() / 1000.0; + JSValue argv[] = { JS_NewFloat64(ctx, timestamp) }; JSValue ret = JS_Call(ctx, js_func, global_object, 1, argv); JS_FreeValue(ctx, argv[0]); if (JS_IsException(ret)) {