Supertime
High precision timer module for node.js. It calculates a timespan in nanosecond precision.
const supertime = // start a timerconst timer = supertimestart // do some fancy stuffconst sum = 1 + 1if sum === 2 result = 'yeah!' const duration = timer console
The supertime.start()
method returns a Supertime
object which represents the timer.
To stop a timer, call timer.stop()
. It returns a duration object, which contains the timespan in nanoseconds and returns the timespan as readable string if it gets converted into a string.
const supertime = // start a timerconst timer = supertimestart // do some fancy stuff const duration = timer console // logs the timespan in nanosecondsconsole // logs the timespan as a readable string