-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Port from joyent/node: timers: fix timeout when added in timer's callback
#2232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -455,7 +455,7 @@ exports.fileExists = function(pathname) { | |
| }; | ||
|
|
||
| exports.busyLoop = function busyLoop(time) { | ||
| var startTime = new Date().getTime(); | ||
| var startTime = Date.now(); | ||
| var stopTime = startTime + time; | ||
| while (new Date().getTime() < stopTime); | ||
| while (Date.now() < stopTime); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am on mobile right now. I would like to check if this will be an infinite loop if
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anything
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah cool then :) |
||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const? Also do we really need this? I mean we can directly useDate.now()in the following statement no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice, true.