Skip to content

Commit a6dfca9

Browse files
authored
fix: do not use performance.now if it's not available (#5897)
1 parent e976756 commit a6dfca9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/fancy-vans-shave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect": patch
3+
---
4+
5+
Ensure `performance.now` is only used if it's available

packages/effect/src/internal/clock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const globalClockScheduler: Clock.ClockScheduler = {
4040

4141
const performanceNowNanos = (function() {
4242
const bigint1e6 = BigInt(1_000_000)
43-
if (typeof performance === "undefined") {
43+
if (typeof performance === "undefined" || typeof performance.now !== "function") {
4444
return () => BigInt(Date.now()) * bigint1e6
4545
}
4646
let origin: bigint

0 commit comments

Comments
 (0)