convert-hrtime

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

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
convert-hrtime
5305.0.03 years ago9 years agoMinified + gzip package size for convert-hrtime in KB

Readme

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}