Skip to content

Commit

Permalink
fix regression in process.hrtime detection (#1594)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored Nov 3, 2023
1 parent fa31a15 commit a3a31c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-badgers-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

fix regression in process.hrtime detection
8 changes: 4 additions & 4 deletions src/internal/clock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as Duration from "../Duration"
import type * as Effect from "../Effect"
import * as Either from "../Either"
import { constFalse } from "../Function"
import { hasProperty, isFunction } from "../Predicate"
import * as core from "./core"
import * as timeout from "./timeout"

Expand Down Expand Up @@ -55,9 +54,10 @@ const performanceNowNanos = (function() {
return () => origin + BigInt(Math.round(performance.now() * 1_000_000))
})()
const processOrPerformanceNow = (function() {
const processHrtime = hasProperty(process, "hrtime") && isFunction(process.hrtime.bigint) ?
process.hrtime :
undefined
const processHrtime =
typeof process === "object" && "hrtime" in process && typeof process.hrtime.bigint === "function" ?
process.hrtime :
undefined
if (!processHrtime) {
return performanceNowNanos
}
Expand Down

0 comments on commit a3a31c7

Please sign in to comment.