Name | Last modified | Size | Description | |
---|---|---|---|---|
Parent Directory | - | |||
index.js | 8 years ago | 470 | ||
README.md | 8 years ago | 583 | d7c1522 post receive test [كارل مبارك] | |
package.json | 2 years ago | 1.5K |
Gets the current time in nanoseconds or microseconds.
In node.js you can get high resolution time with process.hrtime()
, but it is from an unknown relative time, not epoch. So this library helps that by calculating the difference and adding it to the current time.
Since javascript can't hold a nanosecond as an INT safely (Number.MAX_SAFE_INTEGER), we return a string instead.
const now = require('nano-time');
now(); // '1476742925219947761' (returns a string)
now.micro(); // '1476742921398373'
now.microseconds(); // alias for now.micro();