Shouldn't timers be specified?

Andrea Giammarchi andrea.giammarchi at gmail.com
Sun Jan 22 23:05:21 PST 2012


var d = new Date, i = setInterval(function () {console.log(new Date - d); d
= new Date;}, 1);

most likely gonna fire a sequence of

10
0
11
0
12
0
10
0
11
0
10
0

... not really reliable, even if delay is specified to 10 o 20, does not
look that consistent

with setTimeout, I have tried delay 3 and it's never less than 10 or 11,
but with delay 1 is almost always 0:
var d = new Date, delay = 3, i = setTimeout(function t() {console.log(new
Date - d); d = new Date; i = setTimeout(t, delay);}, delay);

br

On Mon, Jan 23, 2012 at 4:43 AM, Rick Waldron <waldron.rick at gmail.com>wrote:

> Node.js does *not* conform. Not at all. Not only it doesn't clamp to 4ms
>> (which happens to be a good thing, IMO), but its timers often fire out of
>> order !
>>
>
> Is there a reference or test case you can cite for this?  Thanks!
>
> Rick
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120123/9d238928/attachment.html>


More information about the es-discuss mailing list