javascript - May the actual delay of setTimeout be shorter? - Stack Overflow

admin2025-04-26  1

According to documentation the actual delay of setTimeout may be longer than was asked. Could you please point me on documentation or question with answer which explains may the actual delay of setTimeout be shorter than was asked?

Thing is I encountered an issue which happened really seldom and could be explained by such phenomenon. Platforms: Chrome Version 67, NodeJS Version 9.8.0. Also, I am really curious is this statement true for Firefox and other browsers?

According to documentation the actual delay of setTimeout may be longer than was asked. Could you please point me on documentation or question with answer which explains may the actual delay of setTimeout be shorter than was asked?

Thing is I encountered an issue which happened really seldom and could be explained by such phenomenon. Platforms: Chrome Version 67, NodeJS Version 9.8.0. Also, I am really curious is this statement true for Firefox and other browsers?

Share Improve this question asked Jun 18, 2018 at 14:33 KosKos 1,77817 silver badges27 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 6

You can test a timeout or interval accuracy by taking a delta of two microtimes. In my tests, the timers are plus or minus a few milliseconds. Run the program below to see the results in your own environment.

In a perfect world, the output would always show 1000. The variance in the output means our world is imperfect

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745601473a309332.html

最新回复(0)