https://github.com/hughsk/right-now
Get the quickest, most high-resolution timestamp possible in node or the browser
https://github.com/hughsk/right-now
Last synced: 2 months ago
JSON representation
Get the quickest, most high-resolution timestamp possible in node or the browser
- Host: GitHub
- URL: https://github.com/hughsk/right-now
- Owner: hughsk
- License: other
- Created: 2013-08-27T03:56:36.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-06-09T19:34:37.000Z (about 11 years ago)
- Last Synced: 2025-03-24T10:55:10.402Z (3 months ago)
- Language: JavaScript
- Size: 1.94 MB
- Stars: 57
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# right-now [](http://github.com/hughsk/stability-badges) #
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 ##
``` bash
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`