This gist...

http://gist.github.com/4010472

...contains a program that executes a function every millisecond using
setInterval. It then uses setTimeout to executes a function every two
milliseconds, then every millisecond, then it invokes a function
repeatedly with a zero value (which is supposed to be reset to 1
according to the documentation.) Finally, it invokes a function
repeatedly using nextTick.

Using the high-resolution timer, the program samples the intervals and
prints them to standard out.

The setInterval function works as expected, invoking its callback at
millisecond intervals. With a value of 2, setTimeout will invoke its
callback after a two millisecond interval. With a value of 1 or 0,
setTimeout calls back its callback immediately, in about two
microseconds, a little bit faster than nextTick.

Is this correct? I'd expect that setTimeout would always wait for at
least a millisecond before invoking its callback. 

--
Alan Gutierrez - @bigeasy

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to