Wednesday 29 January 2020

setInterval() infinitely fluctuaing in Node?

Hello all,In NodeJS, when I do something like the following:var initial = new Date().getMilliseconds() //Get initial Milliseconds setInterval(()=>console.log(new Date().getMilliseconds()-initial),1000) //Log the 'drift' every second The code starts to drift (as the console output shows)This seems to be the case with NodeJS only as if I were to run it in a console right here (on the chrome browser), I get tiny fluctuations that range from 0-2 but which don't continue to go up.In nodeJS, the fluctuations range from 1-infinite?Results

Submitted January 29, 2020 at 08:07AM by BarfAngel198

No comments:

Post a Comment