You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varstartTime=+newDate()while((newDate-startTime)<1000){}setTimeout(function(){varstartTime=+newDate()while((newDate-startTime)<3000){}vart1=newDatesetTimeout(function(){console.log(newDate-t1,'new Date - t1')// !!!!!!!!!!diff is 3000+, should be 20+},20)},20)
timediff should be 20+ms, but it would equal to the while block time.
Activity
alsotang commentedon Aug 31, 2016
In chrome 52.0.2743.116, the result is right.
medns commentedon Aug 31, 2016
i review timers.js@v4.5.0 code, found the following code can be cause this problem.
change to
can alleviate this issue
but in master version change the timeRemaining calc solve this issue
alsotang commentedon Aug 31, 2016
here?
https://github.com/nodejs/node/blob/master/lib/timers.js#L171-L179
alsotang commentedon Aug 31, 2016
seems v6.5.0 solved this issue, should I close this?
benjamingr commentedon Aug 31, 2016
@alsotang can you please test on latest 5.x?
Fishrock123 commentedon Aug 31, 2016
This was fixed by 5aac4c4 which landed in v6.x here: 49a6ea1
The v5.x branch is now end-of-life and will not receive it.
As noted in #3063 (comment), this fix is not on v4.x at the current time, but should probably land at some point.
alsotang commentedon Sep 1, 2016
ok, I start use v6.5.0 right now.