Timed Press

Measuring the duration of a mousedown event.

This actually turned out to be an interesting problem. Which of these is preferable — to do some constant date math and get the difference between a start date and now, or to count the fractions of seconds between two points in time?

The current theory — date math may be expensive, but since JavaScript runs in a single thread and is prone to being held up by other DOM events, we run the risk of delays.

Press and hold the circle to start counting.

Elapsed time: 0.00

Le Code: