aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/util/timer.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-08-06 17:15:46 +0200
committerFlorian Dold <florian@dold.me>2021-08-06 17:15:46 +0200
commit06db37640e9932f9d2595ffa7c3cefe2204326db (patch)
tree55aebb32b6516b5287f6df892360503ea5f5433b /packages/taler-wallet-core/src/util/timer.ts
parent05e52d4e116222728d9bcba3bcbf9e441bb4e4ed (diff)
downloadwallet-core-06db37640e9932f9d2595ffa7c3cefe2204326db.tar.xz
perf: do bulk read
Diffstat (limited to 'packages/taler-wallet-core/src/util/timer.ts')
-rw-r--r--packages/taler-wallet-core/src/util/timer.ts11
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);
})();
/**