I've got a problem with this piece of code. Sometimes the clock is one hour late but I can't see what's wrong and sometimes the clock shows the right time.

Some help me, please.


this.onEnterFrame = function(){
d = new Date();
day = (d.getDate() < 10)? "0" + d.getDate() : d.getDate();
month = (d.getMonth() < 10)? "0" + d.getMonth() : d.getMonth();
year = d.getYear();
hour = d.getHours();
minute = (d.getMinutes() < 10)? "0" + d.getMinutes() : d.getMinutes();

str = "[ " + day + "." + month + "." + year + " - " + hour + ":" + minute + " ]";
clock = str;

}