Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
approximate-now
Advanced tools
Approximate (fast) current UNIX time.
Sometimes you don't care about the exact time the event took place, but rather need to know approximately when. If your use case is performance sensitive, then Date.now()
might not be the best option because it has a measurable impact to the performance. approximate-now
provides an approximate (to the error of 50ms) time without a performance penalty of Date.now()
.
import {
approximateTime,
} from 'approximate-now';
// `approximateTime.now` value is updated by reference every 50ms.
console.log(approximateTime.now);
It is guaranteed that two consequent attempts to retrieve time within the same 50ms time window will have unique values, i.e.
Assuming that the current time is 0000000000000
, then:
approximateTime.now; // 0000000000000
approximateTime.now; // 0000000000001
approximateTime.now; // 0000000000002
However, if approximateTime.now
is accessed more than 50 times within the same 50ms time window, then the top-most value within that interval is returned repeatedly.
approximateTime.now; // 0000000000000
approximateTime.now; // 0000000000001
approximateTime.now; // 0000000000002
// approximateTime.now x 50
approximateTime.now; // 0000000000050
approximateTime.now; // 0000000000050
approximateTime.now; // 0000000000050
Date.now() x 19,900,411 ops/sec ±0.59% (93 runs sampled)
approximateTime.now x 82,420,291 ops/sec ±0.83% (92 runs sampled)
Any sort of time-sensitive operations when it is sufficient to retrieve an approximate timestamp, e.g. roarr
logger uses approximate-now
to record the time when a log message was produced.
FAQs
Approximate (fast) current UNIX time.
The npm package approximate-now receives a total of 2,225 weekly downloads. As such, approximate-now popularity was classified as popular.
We found that approximate-now 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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.