Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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,
  hrtime2us,
  hrtime2ms,
  hrtime2
} = require('@dnlup/hrtime-utils')

const time = process.hrtime()

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

const delta = process.hrtime(time)

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

API

hrtime2ns(time)

This function converts time to nanoseconds.

hrtime2us(time)

This function converts time to microseconds.

hrtime2ms(time)

This function converts time to milliseconds.

hrtime2s(time)

This function converts time to seconds.

Keywords

FAQs

Package last updated on 09 Nov 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