nano-time
Current Time in Nanoseconds
Last updated 3 years ago by ksmithson .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install nano-time 
SYNC missed versions from official npm registry.

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();

Current Tags

  • 1.0.0                                ...           latest (3 years ago)

1 Versions

  • 1.0.0                                ...           3 years ago

Copyright 2014 - 2017 © taobao.org |