* @param timeoutMs
*/
function dummyTimeoutBusyWait (timeoutMs) {
- const timeoutTimestampMs = Date.now() + timeoutMs
+ const timeoutTimestampMs = performance.now() + timeoutMs
// eslint-disable-next-line no-empty
- do {} while (Date.now() < timeoutTimestampMs)
+ do {} while (performance.now() < timeoutTimestampMs)
}
/**
* @param intervalMs
*/
async function sleepTimeoutBusyWait (timeoutMs, intervalMs = interval) {
- const timeoutTimestampMs = Date.now() + timeoutMs
+ const timeoutTimestampMs = performance.now() + timeoutMs
do {
await sleep(intervalMs)
- } while (Date.now() < timeoutTimestampMs)
+ } while (performance.now() < timeoutTimestampMs)
}
/**