Created
April 24, 2019 15:15
-
-
Save L3au/f051cf2139237430ec578b03666ad8da to your computer and use it in GitHub Desktop.
microtime using process.hrtime
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
'use strict' | |
const time = Date.now() * 1e3 | |
const start = process.hrtime() | |
module.exports.now = function () { | |
const diff = process.hrtime(start) | |
return time + diff[0] * 1e6 + Math.round(diff[1] * 1e-3) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment