Socket
Socket
Sign inDemoInstall

time-span

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

time-span

Simplified high resolution timing


Version published
Maintainers
1
Weekly downloads
539,196
decreased by-8.28%

Weekly downloads

Readme

Source

time-span

Simplified high resolution timing

Uses process.hrtime in Node.js and performance.now in browsers (accurate to 5 microseconds).

Install

$ npm install time-span

Usage

import timeSpan from 'time-span';

const end = timeSpan();

timeConsumingFn();

console.log(end());
//=> 1745.3186

console.log(end.rounded());
//=> 1745

console.log(end.seconds());
//=> 1.7453186

API

const end = timeSpan()

Returns a function, that when called, returns the time difference.

end()

Elapsed milliseconds.

end.rounded()

Elapsed milliseconds rounded.

end.seconds()

Elapsed seconds.

end.nanoseconds()

Elapsed nanoseconds.

Keywords

FAQs

Last updated on 26 Jun 2022

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