←back to thread

setBigTimeout

(evanhahn.com)
210 points cfj | 1 comments | | HN request time: 0s | source
Show context
bufferoverflow ◴[] No.41885979[source]
setTimeout is stranger than you think.

We recently had a failed unit test because setTimeout(fn, 1000) triggered at 999ms. That test had ran more than a hundred times before just fine. Till one day it didn't.

replies(5): >>41885984 #>>41886191 #>>41886471 #>>41886483 #>>41886563 #
1. _flux ◴[] No.41886471[source]
I wonder if your 999ms was measured using wall-clock time or a monotonic time source? I imagine a wee time correction at an inopportune time could make this happen.