From e61733e9b92758e807a6587e906cdce477307ca3 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 23 Feb 2014 15:44:34 -0800 Subject: Align timer interval with start of second. --- tempo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tempo.js') diff --git a/tempo.js b/tempo.js index db8c039..04c1071 100644 --- a/tempo.js +++ b/tempo.js @@ -29,7 +29,8 @@ function updateTime() { function startTempo() { updateTime(); - setInterval(updateTime, 1000); + setTimeout(function() {updateTime(); setInterval(updateTime, 1000)}, + 1000 - new Date().getTime() % 1000); } window.onload = startTempo; -- cgit v1.2.3-70-g09d2