time-span
Simplified high resolution timing
Uses process.hrtime
in Node.js and performance.now
in browsers (accurate to 5 microseconds).
Install
$ npm install time-span
Usage
import timeSpan from 'time-span';
const end = timeSpan();
timeConsumingFn();
console.log(end());
console.log(end.rounded());
console.log(end.seconds());
API
const end = timeSpan()
Returns a function, that when called, returns the time difference.
end()
Elapsed milliseconds.
end.rounded()
Elapsed milliseconds rounded.
end.seconds()
Elapsed seconds.
end.nanoseconds()
Elapsed nanoseconds.