W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2010

[whatwg] Timeouts and monotonic vs clock time

From: Simon Fraser <smfr@me.com>
Date: Wed, 03 Nov 2010 20:08:23 -0700
Message-ID: <3E2FB0C5-9E82-46DF-8EE2-D5077C486374@me.com>
On Nov 3, 2010, at 8:01 PM, and-py wrote:

> Here's a curious little issue.
> 
> 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.

Another issue to consider here is what happens when the machine goes to sleep,
and then wakes up. This is a much more common scenario than the user
changing the system clock.

Simon
Received on Wednesday, 3 November 2010 20:08:23 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:28 UTC