Created
December 30, 2013 15:51
-
-
Save sapher/8183715 to your computer and use it in GitHub Desktop.
Simply convert the "high-resolution real time" (difference) provided by NodeJS to an understandable value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.convertHrTimeToMs = (hrtime) => | |
diff = process.hrtime(hrtime) | |
return parseInt((diff[0] * 1e9 + diff[1]) * 1e-6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convertHrTimeToMs = require("./convertHrTimeToMs.coffee").convertHrTimeToMs | |
time = process.hrtime() | |
setTimeout () => | |
console.log convertHrTimeToMs time | |
#output 1253 (ms) for example | |
, 1250 #ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment