convert-hrtime
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

convert-hrtime

Convert the result of process.hrtime.bigint() to seconds, milliseconds, nanoseconds

Install

$ npm install convert-hrtime

Usage

import convertHrtime from 'convert-hrtime';

const startTime = process.hrtime.bigint();
expensiveCalculation();
const diff = process.hrtime.bigint() - startTime;

convertHrtime(diff);
//=> {seconds: 0.000002399, milliseconds: 0.002399, nanoseconds: 2399n}

Package Sidebar

Install

npm i convert-hrtime

Weekly Downloads

939,645

Version

5.0.0

License

MIT

Unpacked Size

3.33 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus