m 0
m 1
m 2
m 3
m 4
m 5
m 6
m 7
m 8
m 9



glej: http://www.brothercake.com/scripts/stopwatch.php

This script counts elapsed time in milliseconds. You can store times in the ten memory locations by clicking the m+ button. When all ten memories are full, it will start again from m0.
As an interesting note, when I first published this script I was using a 1 millisecond setTimeout to increase the clock value, until I noticed that this is innacurate: applications take turns for a "slice" of CPU time, and the time they have to wait will vary; a 200 millisecond timeout may take 202 milliseconds, or 204, and this gradually sends the stopwatch out of time.
What I did to improve accuracy is not rely on the figures from the timeout, but q uery the system time fresh each loop and compare the difference with when you clicked the start button. So although the 'snapshot' figure in the clock display is never completely true - it'll always be a fraction of a second too slow or fast - the overall result is that it stays accurately in time. Actually it's quite trippy to watch