JSPM

right-now

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 231178
  • Score
    100M100P100Q172056F
  • License MIT

Get the quickest, most high-resolution timestamp possible in node or the browser

Package Exports

  • right-now

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (right-now) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

right-now stable

Get the quickest, most high-resolution timestamp possible in node or the browser.

Instead of returning the date, right-now may use performance.now, Date.now, +new Date or process.hrtime to 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 :)

Installation

npm install right-now

Usage

require('right-now')()

Returns a timestamp. In node, this uses process.hrtime. In the browser, support for the following is checked in this order:

  • performance.now()
  • Date.now()
  • +new Date