Last active
March 11, 2022 20:59
-
-
Save deepal/f3353a6ac9515676ee2904015a6fa55e to your computer and use it in GitHub Desktop.
This file contains hidden or 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(); // set time to 1 min ahead of actual time | |
const startTimeToD = Date.now(); // set startTime with time-of-day clock | |
setImmediate(() => { | |
correctTimeNTP(); // synchronise the clock | |
}); | |
await doSomething(); | |
const endTimeToD = Date.now(); // set endTime with time-of-day clock | |
const durationToD = endTimeToD - startTimeToD; | |
console.log(`Duration measured by time-of-day clock\t: ${durationToD}ms`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment