Re: Synchronize timer with internal clock
Re: Synchronize timer with internal clock
- Subject: Re: Synchronize timer with internal clock
- From: John Timmer <email@hidden>
- Date: Fri, 14 Mar 2003 18:53:51 -0500
While on the subject of timers vs. the internal clock:
How accurate are timers expected to be? I had coded something where, in
order to keep a clock display reasonably close to accurate, I was firing a
timer every 5 seconds. This seemed wasteful and inelegant, so I decided to
synchronize with the minute and fire the timer every 60 seconds. Doing so
revealed a steady downward creep when I logged the firing of the timer (see
below). I kept going, hoping that eventually it would tick up to
compensate, but instead it eventually wrapped around the minute, leaving my
clock 59.998 seconds off.
Is there any way around this, or should I be checking the accuracy of the
timer every time through and invalidating it when necessary?
John
Note the steady reduction in when the timer fired:
2003-03-14 18:31:00.453 Weather View[7155] updating time
2003-03-14 18:32:00.409 Weather View[7155] updating time
2003-03-14 18:33:00.401 Weather View[7155] updating time
2003-03-14 18:34:00.393 Weather View[7155] updating time
2003-03-14 18:35:00.385 Weather View[7155] updating time
2003-03-14 18:36:00.377 Weather View[7155] updating time
2003-03-14 18:37:00.369 Weather View[7155] updating time
2003-03-14 18:38:00.361 Weather View[7155] updating time
2003-03-14 18:39:00.353 Weather View[7155] updating time
2003-03-14 18:40:00.349 Weather View[7155] updating time
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.