@ljharb/now
v1.0.1
Published
The current time in milliseconds, from the most precise monotonic clock available (`performance.now` → `process.hrtime` → `Date.now` → `new Date().getTime()`), for measuring elapsed time.
Maintainers
Readme
@ljharb/now 
The current time, in milliseconds, from the most precise monotonic clock available - performance.now(), then process.hrtime(), then Date.now(), then new Date().getTime() (for ES3). Works in browsers and node, all the way back to ES3.
The returned value has an arbitrary origin and is only meaningful relative to another call: subtract two readings to get an elapsed duration, in milliseconds. Where the platform provides a monotonic clock (the first two tiers), it is unaffected by system clock changes.
Usage / Example
var now = require('@ljharb/now');
var assert = require('assert');
assert.equal(typeof now(), 'number');
var start = now();
// ... do some work ...
var elapsed = now() - start;
assert.equal(typeof elapsed, 'number');
assert.ok(elapsed >= 0);
