Package Exports
- nano-time
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 (nano-time) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
NanoTime
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.
Usage
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();