A Stopwatch and Timer With Lap Tracking and Timestamp-Based Accuracy Browser timers accumulated through setInterval drift when tabs are backgrounded. Timestamp-based timing doesn't. Track startedAt when the stopwatch starts, compute elapsed as now - startedAt + accumulatedPauses on each render. The stopwatch is accurate whether you're watching it or not. Stopwatches and timers should be boring