⏱️ Stopwatch & Laps
ℹ️ What this tool does & how it works
The usual way to write a stopwatch — add 10 ms every 10 ms — drifts with every timer the browser decides to delay, and a backgrounded tab can lose seconds. This one stores start timestamps from the system clock and does subtraction, so even if the display skips, the numbers never do. Laps are differences of the same clock, which makes the split table exact.
Why a stopwatch is a subtraction, not a counter
Browsers deliberately delay timers in hidden tabs — a setInterval asked for every 50 ms may only wake once a second there, and a stopwatch built by adding ticks would then report a 100 m sprint as 20 seconds. The fix is to never accumulate: store the start moment from the system clock, subtract on every paint, and treat the display timer as decoration. The same discipline powers the lap list — a split is two elapsed readings taken at different moments, so throttling between them changes nothing. If you\u2019ve ever seen a phone stopwatch "catch up" after you switch back to it, that\u2019s this design working; one that quietly loses the time instead is the broken kind.