Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

convert-hrtime

sindresorhus9.2mMIT5.0.0TypeScript support: included

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

process, hrtime, time, highres, performance, bench, benchmark, measure, seconds, milliseconds, nanoseconds

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}