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.2 to 0.29.3

23

internal_effect_untraced/clock.js

@@ -47,9 +47,16 @@ "use strict";

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));
};
if (typeof performance === "undefined") {
return () => BigInt(Date.now()) * 1000000n;
}
const origin = "timeOrigin" in performance && typeof performance.timeOrigin === "number" ? /*#__PURE__*/BigInt( /*#__PURE__*/Math.round(performance.timeOrigin * 1000000)) : /*#__PURE__*/BigInt( /*#__PURE__*/Date.now()) * 1000000n;
return () => origin + BigInt(Math.round(performance.now() * 1000000));
}();
const processOrPerformanceNow = /*#__PURE__*/function () {
const processHrtime = typeof process === "object" && "hrtime" in process ? process.hrtime : undefined;
if (!processHrtime) {
return performanceNowNanos;
}
const origin = /*#__PURE__*/performanceNowNanos() - /*#__PURE__*/processHrtime.bigint();
return () => origin + processHrtime.bigint();
}();
/** @internal */

@@ -59,4 +66,2 @@ class ClockImpl {

this[_a] = ClockTypeId;
this.processHrtime = typeof process === "object" && "hrtime" in process ? process.hrtime : undefined;
this.timeOrigin = this.processHrtime ? performanceNowNanos() - this.processHrtime.bigint() : 0n;
}

@@ -67,3 +72,3 @@ unsafeCurrentTimeMillis() {

unsafeCurrentTimeNanos() {
return this.processHrtime ? this.timeOrigin + this.processHrtime.bigint() : performanceNowNanos();
return processOrPerformanceNow();
}

@@ -70,0 +75,0 @@ currentTimeMillis() {

{
"name": "@effect/io",
"version": "0.29.2",
"version": "0.29.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

@@ -43,9 +43,20 @@ 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))
if (typeof performance === "undefined") {
return () => BigInt(Date.now()) * 1_000_000n
}
const origin = "timeOrigin" in performance && typeof performance.timeOrigin === "number" ?
BigInt(Math.round(performance.timeOrigin * 1_000_000)) :
BigInt(Date.now()) * 1_000_000n
return () => origin + BigInt(Math.round(performance.now() * 1_000_000))
})()
const processOrPerformanceNow = (function() {
const processHrtime = typeof process === "object" && "hrtime" in process ? process.hrtime : undefined
if (!processHrtime) {
return performanceNowNanos
}
const origin = performanceNowNanos() - processHrtime.bigint()
return () => origin + processHrtime.bigint()
})()

@@ -56,7 +67,2 @@ /** @internal */

readonly processHrtime = typeof process === "object" && "hrtime" in process ? process.hrtime : undefined
readonly timeOrigin = this.processHrtime ?
performanceNowNanos() - this.processHrtime.bigint() :
0n
unsafeCurrentTimeMillis(): number {

@@ -67,5 +73,3 @@ return Date.now()

unsafeCurrentTimeNanos(): bigint {
return this.processHrtime ?
this.timeOrigin + this.processHrtime.bigint() :
performanceNowNanos()
return processOrPerformanceNow()
}

@@ -72,0 +76,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