hirestime
hirestime is a thin wrapper around process.hrtime()
that does the clumsy handling of the returned array for you.
Since version 2.1 this module also works in the browser.
Installation
npm install hirestime
hirestime()
returns a function:
returnedFunction([unit])
returns the elapsed time since the call of hirestime
in milliseconds.
an optional unit parameter can be specified that will cause an recalculation.
possible parameters
hirestime.S
elapsed time in secondshirestime.MS
elapsed time in milliseoncdshirestime.NS
elapsed time in nanoseconds
Examples
var hirestime = require('../')
var getElapsed = hirestime()
setTimeout(_ => {
console.log(getElapsed())
}, 1000)
var hirestime = require('../')
var getElapsed = hirestime()
setTimeout(_ => {
console.log(getElapsed(hirestime.S))
}, 1000)