Misc dependency updates

This commit is contained in:
Nicolas Gallagher
2022-07-04 14:35:24 -07:00
parent 0e183ede7c
commit 1aa84d5447
6 changed files with 756 additions and 135 deletions
@@ -1,17 +1,9 @@
// @flow
const NS_PER_MS = 1e6;
const MS_PER_S = 1e3;
// Returns a high resolution time (if possible) in milliseconds
export function now(): number {
if (window && window.performance) {
return window.performance.now();
} else if (process && process.hrtime) {
const [seconds, nanoseconds] = process.hrtime();
const secInMS = seconds * MS_PER_S;
const nSecInMS = nanoseconds / NS_PER_MS;
return secInMS + nSecInMS;
} else {
return Date.now();
}