From a39cb4b0fc9938342db444f641d7eceb8f341dcf Mon Sep 17 00:00:00 2001 From: Troy Crosley Date: Wed, 14 Dec 2022 10:23:26 -0500 Subject: [PATCH] gl.js: use performance timer Use performance.now instead of Date.now, which may provide a higher-resolution time (depending on the browser's Spectre mitigation settings). The time returned will no longer be relative to the Unix epoch and system clock. --- js/gl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/gl.js b/js/gl.js index cf2a972f..5697bf89 100644 --- a/js/gl.js +++ b/js/gl.js @@ -615,7 +615,7 @@ var importObject = { return Math.floor(Math.random() * 2147483647); }, now: function () { - return Date.now() / 1000.0; + return performance.now() / 1000.0; }, canvas_width: function () { return Math.floor(canvas.width);