Skip to main content
00:00:00.00

Guide to Time Measurement

Why measure time?

A stopwatch is an essential tool for accurate time measurement used in many areas of life. From sports and fitness to cooking and time management. It helps you track how long specific tasks take and optimize your activities for better productivity.

Applications in sports

In training, a stopwatch measures lap times, interval training, or rest periods between sets. Professional athletes use it for performance analysis and setting personal records. You can also track training progress over weeks and months.

Productivity and time management

A stopwatch helps with time management techniques like Pomodoro, where you work for a set time (e.g., 25 minutes) then take a break. You can also use it to determine how long specific tasks take, allowing better day planning and estimating how much you can accomplish.

Tips for effective use

Before starting, ensure the stopwatch is ready and you are in a comfortable position. During exercise, hold the stopwatch in your hand or place it in a visible location. Record lap times for history and analysis. Use the lap function to save intermediate times without stopping the main measurement.

A stopwatch that counts its own ticks loses a minute every hour

The obvious way to build a stopwatch is to add 100 ms on every timer tick. Measured over fifty ticks, that approach ran 84 ms slow in five seconds — 1.68 ms lost per tick, which extrapolates to roughly 60 seconds an hour. The error is always in the same direction, because a tick can arrive late but never early.

How it works

  • Times elapsed intervals and records laps against a single reference point.
  • Derives elapsed time from timestamps rather than accumulating ticks, which is what keeps it accurate.
  • Keeps running correctly when the tab is backgrounded, where tick-counting fails hardest.
wrong:  elapsed += interval   on every tick
right:  elapsed = now − startTime

the first accumulates every scheduling delay
the second re-reads the clock and cannot drift at all

Worked example

Fifty ticks of a 100 ms interval, measured against the wall clock.

  1. ideal elapsed: 5,000 ms
  2. actual elapsed: 5,084 ms
  3. drift: 84 ms in five seconds
  4. per tick: 1.68 ms late
  5. extrapolated: about 60 seconds per hour

A minute an hour, from an implementation that looks correct. Reading the clock instead — elapsed equals now minus start — produces the same display with no accumulated error, because each frame recomputes from the origin rather than adding to a running total.

Reading the result

  • Timer callbacks are scheduled, not guaranteed. The specified delay is a minimum, so the browser is free to run the callback late when the main thread is busy — and every late arrival is permanently baked into a total that only ever adds.
  • Background tabs make it far worse. Browsers throttle timers in hidden tabs, commonly to once per second or less, so a tick-counting stopwatch left in a background tab can lose minutes rather than seconds. A timestamp-based one is unaffected: it simply reads the correct elapsed time when you return.
  • For measuring durations, prefer a monotonic clock where one is available. The wall clock can jump backwards when the system time is corrected or a daylight-saving change lands, which can produce a negative elapsed time from an otherwise correct calculation.
  • Display precision is not measurement precision. Showing hundredths of a second is easy; being accurate to hundredths across an hour requires that the arithmetic never accumulates, and the two are unrelated properties.

Common questions

Why is my timer slower than my phone's?
It is almost certainly counting ticks rather than reading the clock. Each callback arrives a fraction late, the delays add up, and the total falls behind — measured here at 84 ms per five seconds. Nothing is wrong with the machine; the arithmetic is losing time by design.
Does it keep counting if I switch tabs?
A timestamp-based stopwatch does, because it recomputes elapsed time from the start when you come back. A tick-counting one does not: browsers throttle timers in hidden tabs, so it simply misses ticks and under-reports, sometimes by minutes.