D
Dr John Stockton
JRS: In article <[email protected]>, dated Tue, 9 Nov
2004 19:20:03, seen in Darren Showers
That gives a delay of 1000 ms, rounded up to the next clock tick; there
will also be the delay in executing the code that precedes it.
You need to calculate the delay to the next second, or say 10% of the
way through it, as for example
setTimeout("Tock()", 1100-D%1000)
where D = new Date().
Read the c.l.j newsgroup FAQ; see below; see js-date0.htm#TaI .
2004 19:20:03, seen in Darren Showers
I'm running a timer function that counts down from set time frames.
It has an odd tendency to drop 2 seconds at the beginning but then
work fine the rest of the way. Can anyone suggest what could be
happening here?
if (running) {
timerID = setTimeout("showCountDown()",1000)
}
That gives a delay of 1000 ms, rounded up to the next clock tick; there
will also be the delay in executing the code that precedes it.
You need to calculate the delay to the next second, or say 10% of the
way through it, as for example
setTimeout("Tock()", 1100-D%1000)
where D = new Date().
Read the c.l.j newsgroup FAQ; see below; see js-date0.htm#TaI .