Javascript - How to do get accurate the timer delay of setinterval? -


this question has answer here:

i having problem delay of setinterval follows:

var playball = setinterval(function() {     // code here      // measure offset time     console.log('time: ' + new date().gettime()); }, 20); 

when execute, delay actual 21 or 22 or more than...which not 20 milliseconds.

where problem?

it's commonly known setinterval() method isn't accurate.

see link find out how method works: https://dzone.com/articles/how-javascript-timers-work


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -