Skip to content

Commit

Permalink
gl.js: use performance timer
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
troyc committed Dec 14, 2022
1 parent 124aca8 commit a39cb4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/gl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a39cb4b

Please sign in to comment.