
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
precisetime
Advanced tools
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.
npm install precisetime
then var preciseTime = require("precisetime").preciseTime
This is pretty much it
FAQs
timing function for Rhino, node, browsers, natively present in JSC
The npm package precisetime receives a total of 0 weekly downloads. As such, precisetime popularity was classified as not popular.
We found that precisetime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.