4 ms·
I wish that was true but you can easily see it drifting in Chrome let lastms function tick() { if (lastms === undefined)
by msoad 2y ago
I wish that was true but you can easily see it drifting in Chrome
let lastms
function tick() {
if (lastms === undefined)
lastms = new Date().getMilliseconds()
else if (lastms !== new Date().getMilliseconds())
throw new Error('Drifted')
}
setInterval(tick, 1000)
- deleted 2y ago[deleted]
- realharo 2y agoIt's only drift if the error grows over time. You need to look at the sum of the offsets.
- deleted 2y ago[deleted]