[whatwg] Timeouts and monotonic vs clock time

Glenn Maynard glenn at zewt.org
Fri Jan 7 15:03:18 PST 2011


On Fri, Jan 7, 2011 at 5:17 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Thu, 4 Nov 2010, and-py wrote:
>> When you use `setTimeout` or `setInterval`, the HTML5 spec seems to say
>> that the callback should occur after a certain amount of actual time has
>> elapsed.
>>
>> But what browsers might do is take the system clock, add the given
>> number of milliseconds and call back when that system clock time is
>> reached. The firing time will differ from the actual-elapsed-time, if
>> the system clock is changed in between the setting and the calling of
>> the callback.

All production operating systems provide monotonic timers, for
precisely this purpose: to measure time intervals, without changes to
the system clock confusing the results.  I'm surprised if browsers
don't make use of them.

>> [snip useful but long description of browser behaviours -- thanks]

Do you have a link to the original message with this text?  Googling
the message body only finds this thread and another snipped quote, not
the original message.

-- 
Glenn Maynard



More information about the whatwg mailing list