diff options
Diffstat (limited to 'packages/taler-wallet-core/src/util/timer.ts')
-rw-r--r-- | packages/taler-wallet-core/src/util/timer.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/packages/taler-wallet-core/src/util/timer.ts b/packages/taler-wallet-core/src/util/timer.ts index a7fe7dd70..7c849fbcc 100644 --- a/packages/taler-wallet-core/src/util/timer.ts +++ b/packages/taler-wallet-core/src/util/timer.ts @@ -78,24 +78,23 @@ class TimeoutHandle { } /** - * Get a performance counter in milliseconds. + * Get a performance counter in nanoseconds. */ -export const performanceNow: () => number = (() => { +export const performanceNow: () => bigint = (() => { // @ts-ignore if (typeof process !== "undefined" && process.hrtime) { return () => { - const t = process.hrtime(); - return t[0] * 1e9 + t[1]; + return process.hrtime.bigint(); }; } // @ts-ignore if (typeof performance !== "undefined") { // @ts-ignore - return () => performance.now(); + return () => BigInt(performance.now()) * BigInt(1000 * 1000); } - return () => 0; + return () => BigInt(0); })(); /** |