In Javascript, the window.setInterval()
and window.setTimeout()
functions are rarely called at the exact times specified. You would be better served to check the actual time in every call to your function, as this will give you the actual system time:
var currentdate = new Date();
var hours = currentdate.getHours();
var minutes = currentdate.getMinutes();
var seconds = currentdate.getSeconds();