Instead of returning the date,
process.hrtimeto get a timestamp suitable for measuring intervals of time. Handy for both animation loops and precision benchmarking.
It's pretty small but saves me writing this boilerplate every time :)
npm install right-now
Returns a timestamp. In node, this uses
process.hrtime. In the browser, support for the following is checked in this order: