Socket
Socket
Sign inDemoInstall

@dnlup/hrtime-utils

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

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
632
increased by92.68%
Maintainers
1
Install size
6.65 kB
Created
Weekly downloads
 

Changelog

Source

1.1.0 (2020-11-09)

Features

  • add hrtime2us (65ce4f3)

Readme

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

Last updated on 09 Nov 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc