-
how can my clock slow down?
Hi,
I recently updated a clock I had made for my site thinking it was working right, but it always showed the local time when I meant it to show the time in my city, Barcelona.
We're a couple of hours behind UCT.
I'm attaching my fla because I really wouldn't find the issue. It works alright on preview but when I post it, it slows down, at least in my end...
try https://webs.ono.com/jpdurba
Attachment 74891
-
I would set an interval to run it. An interval will be accurate to within a second or so for hours. You can check the date every once in a while to be accurate.
clearInterval(intTimer); // clear the interval if it's been set
intTimer = setInterval(fUpdateTime,1000);
function fUpdateTime(){
// update clock by 1 second
updateAfterEvent(); // this is very important, put it at end of function called by interval
}
I've had to make many clocks.
-
thank you so much, Moot, can't wait to fix it when I get home
-
I use intervals for everything.
Be sure to compare the interval's time to the user's time. I think the interval may run a little fast so you lower the interval time a little. It may be best at 998 or something instead of 1000.
-
Will do so, thanks again. I bet it will be a good practice to use it for my local clock as well even if it doesn't have that much code to build the clock
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|