diff --git a/yarn-project/foundation/src/timer/timer.ts b/yarn-project/foundation/src/timer/timer.ts index ee96cbc94a7..bffed5cb97e 100644 --- a/yarn-project/foundation/src/timer/timer.ts +++ b/yarn-project/foundation/src/timer/timer.ts @@ -14,7 +14,7 @@ export class Timer { private start: number; constructor() { - this.start = performance.now(); + this.start = performance ? performance.now() : Date.now(); } /** @@ -32,7 +32,7 @@ export class Timer { * @returns The elapsed time in milliseconds. */ public ms() { - return performance.now() - this.start; + return (performance ? performance.now() : Date.now()) - this.start; } /**