What exactly do you mean? Have you observed that this does indeed update `Date.now()`?
What exactly do you mean? Have you observed that this does indeed update
Date.now()?Date.now()?Date.now() is stale? or are the callbacks just getting executed less frequently than expected?Date.now() time for that microtask, but then they sit in the queue a while. So then once the queue is unblocked, they all run very quickly and you see time as though it is "fast-forwarding"setInterval()workerdsetInterval(() => {
this.currentTime = Date.now();
tickGame();
}, 1000);let lastTicked = Date.now();
const gameLoop = () => {
const delta = Date.now() - lastTicked; // the *actual* number of ms since last tick
this.currentTime += delta;
doGameLogic();
setTimeout(gameLoop, 1000);
};
gameLoop();