Closed haichuanyu closed 9 years ago
This article explains it fairly well.
Instead of setting a delay and incrementing our counter by that delay, we should take the difference between a starting timestamp and a current timestamp to know what time it is.
The first time will suffer from a cumulating delay, the second time will suffer from a constant delay. So the second seems preferable to the first.
http://www.sitepoint.com/creating-accurate-timers-in-javascript/
Fixed. Now it uses the system clock. Checked against the other online stopwatch above and the timer on my phone. Both are spot on.
Spotted by Tee
As compared to another online stopwatch, we're getting 48 seconds to the minute. So, in a 10 second real world time passage, we only count 8 seconds. Not sure why.
http://online-stopwatch.chronme.com/