Socket
Socket
Sign inDemoInstall

@effect/io

Package Overview
Dependencies
Maintainers
3
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/io - npm Package Compare versions

Comparing version 0.29.1 to 0.29.2

16

internal_effect_untraced/clock.js

@@ -45,13 +45,23 @@ "use strict";

};
exports.globalClockScheduler = globalClockScheduler;
const performanceNowNanos = /*#__PURE__*/function () {
const origin = /*#__PURE__*/BigInt( /*#__PURE__*/Math.round(performance.timeOrigin * 1000000));
return () => {
const now = performance.now();
const millis = Math.floor(now);
return origin + BigInt(millis * 1000000) + BigInt(Math.round((now - millis) * 1000000));
};
}();
/** @internal */
exports.globalClockScheduler = globalClockScheduler;
class ClockImpl {
constructor() {
this[_a] = ClockTypeId;
this.processHrtime = typeof process === "object" && "hrtime" in process ? process.hrtime : undefined;
this.timeOrigin = this.processHrtime ? performanceNowNanos() - this.processHrtime.bigint() : 0n;
}
unsafeCurrentTimeMillis() {
return new Date().getTime();
return Date.now();
}
unsafeCurrentTimeNanos() {
return BigInt(Math.round(performance.timeOrigin * 1000000)) + BigInt(Math.round(performance.now() * 1000000));
return this.processHrtime ? this.timeOrigin + this.processHrtime.bigint() : performanceNowNanos();
}

@@ -58,0 +68,0 @@ currentTimeMillis() {

4

package.json
{
"name": "@effect/io",
"version": "0.29.1",
"version": "0.29.2",
"license": "MIT",

@@ -10,3 +10,3 @@ "repository": {

"dependencies": {
"@effect/data": "~0.12.6"
"@effect/data": "~0.12.10"
},

@@ -13,0 +13,0 @@ "publishConfig": {

@@ -42,2 +42,11 @@ import * as Context from "@effect/data/Context"

const performanceNowNanos = (function() {
const origin = BigInt(Math.round(performance.timeOrigin * 1_000_000))
return () => {
const now = performance.now()
const millis = Math.floor(now)
return origin + BigInt(millis * 1000000) + BigInt(Math.round((now - millis) * 1_000_000))
}
})()
/** @internal */

@@ -47,8 +56,15 @@ class ClockImpl implements Clock.Clock {

readonly processHrtime = typeof process === "object" && "hrtime" in process ? process.hrtime : undefined
readonly timeOrigin = this.processHrtime ?
performanceNowNanos() - this.processHrtime.bigint() :
0n
unsafeCurrentTimeMillis(): number {
return new Date().getTime()
return Date.now()
}
unsafeCurrentTimeNanos(): bigint {
return BigInt(Math.round(performance.timeOrigin * 1000000)) + BigInt(Math.round(performance.now() * 1000000))
return this.processHrtime ?
this.timeOrigin + this.processHrtime.bigint() :
performanceNowNanos()
}

@@ -55,0 +71,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc