convert-hrtime

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

MIT 5 个版本
安装
npm install convert-hrtime
yarn add convert-hrtime
pnpm add convert-hrtime
bun add convert-hrtime
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}
版本列表
5.0.0 2021-04-14
4.0.0 2021-04-07
3.0.0 2019-04-09
2.0.0 2017-05-23
1.0.0 2015-12-10