3 ms·
That wouldn't very well because Date.now() isn't monotonic.
by gnachman 2y ago
That wouldn't very well because Date.now() isn't monotonic.
- _flux 2y agoThere is a monotonic time source available in JavaScript, though: https://developer.mozilla.org/en-US/docs/Web/API/Performance_API/High_precision_timing https://developer.mozilla.org/en-US/docs/Web/API/Performance... As I understand it, the precision of such timers has been limited a bit in browsers to mitigate some Spectre attacks (and maybe others), but I imagine it would still be fine for this purpose.