Socket
Socket
Sign inDemoInstall

clockit

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    clockit

Simple high resolution timer for node


Version published
Weekly downloads
1.6K
decreased by-19.57%
Maintainers
1
Install size
3.22 kB
Created
Weekly downloads
 

Readme

Source

npm

clockit

Simple high resolution timer for node

Wraps process.hrtime() in a simple to use interface. No need to multiply and divide to get desired measurement units.

Timer precision is a nanosecond.

*Note: requires Node.js 4 or later.

Install

npm install --save clockit

Usage

const clockit = require('clockit');

var timer = clockit.start();
// ...
var ms = timer.ms; // time passed in milliseconds
var us = timer.us; // time passed in microseconds
var ns = timer.ns; // time passed in nanoseconds

Since time is measured in nanoseconds, ns returns an integer while us and ms return floating point numbers without rounding.

These timer properties return the elapsed time since the start() call. This means that two consecuritve reads of ns for example will return different values taking into account the time between the two calls.

Keywords

FAQs

Last updated on 07 Nov 2016

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