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

precisetime

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

precisetime

timing function for Rhino, node, browsers, natively present in JSC

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by166.67%
Maintainers
1
Weekly downloads
 
Created
Source

preciseTime

JavaScriptCore has a handy global function called preciseTime() which aim is to provide a double, based on time, precise enough to ensure microseconds, but not as greedy as Java nanoTime in therms of clock. This precision has been proposed in W3C but is not available yet.

Since JSC offers this natively, the aim of this little script is to normalize this function that specially when it comes to benchmarks or asynchronous queue ordered by execution time, could be all we need.

The node.js version might require microtime if process.hrtime() is not supported. I have not set the dependency since that module has bindings and it might be more problematic to install.

Browsers that do not implement HighResolutionTime will simply return new Date / 1000 to be consistent with other results.

How To Use

  • in node.js npm install precisetime then var preciseTime = require("precisetime").preciseTime
  • in Rhino just load/include the precisetime.js file inside the build folder
  • in JSC you don't need to do anything
  • in browsers or other envs, load/require/include precisetime.js inside the build

This is pretty much it

Keywords

FAQs

Package last updated on 17 Aug 2012

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