🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

convert-hrtime

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convert-hrtime

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

5.0.0
latest
Source
npm
Version published
Weekly downloads
2M
3.07%
Maintainers
1
Weekly downloads
 
Created

What is convert-hrtime?

The convert-hrtime npm package is designed to convert high-resolution time measurements, typically obtained using process.hrtime(), into various time units such as milliseconds, seconds, nanoseconds, etc. This is particularly useful for performance measurement in Node.js applications where precise timing is crucial.

What are convert-hrtime's main functionalities?

Convert to milliseconds

This feature allows the conversion of a high-resolution time to milliseconds. It is useful for logging or measuring execution time in milliseconds.

const convertHrtime = require('convert-hrtime');
const hrtime = process.hrtime();
const milliseconds = convertHrtime(hrtime).milliseconds;

Convert to seconds

This feature enables the conversion of a high-resolution time to seconds. It can be used when a broader time measurement is sufficient for the application's needs.

const convertHrtime = require('convert-hrtime');
const hrtime = process.hrtime();
const seconds = convertHrtime(hrtime).seconds;

Convert to nanoseconds

This feature provides the ability to convert high-resolution time to nanoseconds, offering the highest precision for performance measurement in critical applications.

const convertHrtime = require('convert-hrtime');
const hrtime = process.hrtime();
const nanoseconds = convertHrtime(hrtime).nanoseconds;

Other packages similar to convert-hrtime

Keywords

process

FAQs

Package last updated on 14 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts