Hacker News new | ask | show | jobs
by menssen 2475 days ago
I don't know the answer to this, but I've always been genuinely curious: how accurate is the Date object?

setInterval's minimum interval is ~15ms [1], so shouldn't something like...

setInterval(() => (new Date()).valueOf() % DESIRED_TICK_INTERVAL < 15 && tickTheMetronome(), 15)

...get you within 15ms accuracy, and it can probably be reduced in Chrome et al?

[1] http://www.adequatelygood.com/Minimum-Timer-Intervals-in-Jav...

1 comments

and to say that 20 years ago people were laughing at MS windows and considering it as a completely non-viable platform for pro audio for its 10ms-accurate timer...