Socket
Socket
Sign inDemoInstall

@dnlup/hrtime-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dnlup/hrtime-utils

A small collection of useful functions to work with Node.js `process.hrtime` values


Version published
Weekly downloads
284
increased by13.15%
Maintainers
1
Weekly downloads
 
Created
Source

hrtime-utils

npm version Tests Coverage Status Known Vulnerabilities

A small collection of useful functions to work with Node.js process.hrtime values.

hrtime-utils is a tiny module that exports a few useful functions that you can use to convert the value returned from process.hrtime() to a time unit.

Installation

$ npm i @dnlup/hrtime-utils

Usage

const {
  hrtime2ns,
  hrtime2ms,
  hrtime2
} = require('@dnlup/hrtim-utils')

const time = process.hrtime()

hrtime2ns(time) // time in nanoseconds
hrtime2ms(time) // time in milliseconds
hrtime2s(time) // time in seconds

const delta = process.hrtime(time)

hrtime2ns(delta) // delta in nanoseconds
hrtime2ms(delta) // delta in milliseconds
hrtime2s(delta) // delta in seconds

API

hrtime2ns(time)

This function converts time to nanoseconds.

hrtime2ms(time)

This function converts time to milliseconds.

hrtime2s(time)

This function converts time to seconds.

Note

If your Node.js environment supports it, you could use process.hrtime.bigint() instead of process.hrtime() and this module.

Keywords

FAQs

Package last updated on 13 Oct 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc