https://github.com/jonschlinkert/nanoseconds
Convert the process.hrtime() array to a single nanoseconds value. (node.js/javascript)
https://github.com/jonschlinkert/nanoseconds
date format hrtime javascript jonschlinkert nanoseconds node nodejs process time timescale
Last synced: about 1 month ago
JSON representation
Convert the process.hrtime() array to a single nanoseconds value. (node.js/javascript)
- Host: GitHub
- URL: https://github.com/jonschlinkert/nanoseconds
- Owner: jonschlinkert
- License: mit
- Created: 2015-10-18T09:43:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-19T22:26:41.000Z (about 7 years ago)
- Last Synced: 2025-05-01T19:40:29.160Z (about 2 months ago)
- Topics: date, format, hrtime, javascript, jonschlinkert, nanoseconds, node, nodejs, process, time, timescale
- Language: JavaScript
- Homepage: https://github.com/jonschlinkert
- Size: 8.79 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nanoseconds [](https://www.npmjs.com/package/nanoseconds) [](https://npmjs.org/package/nanoseconds) [](https://npmjs.org/package/nanoseconds) [](https://travis-ci.org/jonschlinkert/nanoseconds)
> Convert the process.hrtime() array to a single nanoseconds value. This makes it easier to diff times.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save nanoseconds
```## Usage
```js
const nano = require('nanoseconds');
console.log(nano(process.hrtime()));
//=> 725220674029406
```**Examples**
```js
nano([0, 999]);
//=> 999nano([12, 999]);
//=> 12000000999nano(['1298001', '09187662']);
//=> 1298001009187662
```## About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Running Tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```### Related projects
You might also be interested in these projects:
* [o-clock](https://www.npmjs.com/package/o-clock): Simple javascript utility for displaying the time in 12-hour clock format. | [homepage](https://github.com/jonschlinkert/o-clock "Simple javascript utility for displaying the time in 12-hour clock format.")
* [pretty-time](https://www.npmjs.com/package/pretty-time): Easily format the time from node.js `process.hrtime`. Works with timescales ranging from weeks to nanoseconds. | [homepage](https://github.com/jonschlinkert/pretty-time "Easily format the time from node.js `process.hrtime`. Works with timescales ranging from weeks to nanoseconds.")
* [time-stamp](https://www.npmjs.com/package/time-stamp): Get a formatted timestamp. | [homepage](https://github.com/jonschlinkert/time-stamp "Get a formatted timestamp.")
* [timescale](https://www.npmjs.com/package/timescale): Convert from one time scale to another. Nanosecond is the most atomic unit, week is… [more](https://github.com/jonschlinkert/timescale) | [homepage](https://github.com/jonschlinkert/timescale "Convert from one time scale to another. Nanosecond is the most atomic unit, week is the largest unit.")### Author
**Jon Schlinkert**
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)### License
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on March 19, 2018._