Performance.now() and sleep

Demo of Perils of Measuring Long Intervals With Performance.now().

Elapsed time per Performance.now(): 0ms
Elapsed time per Date.now(): 0ms
Difference: 0ms

Instructions

  1. Observe that the elapsed time for both methods are the same (within a few milliseconds)
  2. Put the computer to sleep for a least a minute
  3. Wake up the computer
  4. Observe that the Performance.now()-based time is now significantly behind.