Last active
March 15, 2022 20:40
-
-
Save deepal/48425db8c9e13ee46ce463fbc2648780 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setFakeTime(); | |
const startTimeMon = performance.now(); // set startTime with monotonic clock | |
setImmediate(() => { | |
correctTimeNTP(); // synchronise the clock | |
}); | |
await doSomething(); | |
const endTimeMon = performance.now(); // set endTime with monotonic clock | |
const durationMon = endTimeMon - startTimeMon; | |
console.log(`Duration measured by monotonic clock\t: ${durationMon}ms`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment