Am Fr,22.08.2008 um 15:28 schrieb Graham Cox:


On 22 Aug 2008, at 10:55 pm, Ron Fleckner wrote:

Sorry, my question was very badly put. I've already apologised to two other answerers. I should have said: Is there a better way - other than using an NSTimer - to update the clock? That is, how does the system clock do it?

I think now that this is not strictly a Cocoa question.


Using a timer isn't too bad. Running at two updates per second should be acceptable since you're sampling at twice the highest "event" frequency. You might want to go a bit faster and maybe at a slightly odd multiple of one second to make sure you don't end up with a constant half-second lag.
I think, that a higher event-frequency is not neccessary. He should use an interval of close to one second (something like 0.99 seconds). In his timer method he simply waits in a loop for the "tick tack" and displays the result. So he will not have a constant phase shift (except of the drawing interval).

If the system becomes busy (his application doesn't sound like that), he maybe misses a second. That is acceptable if the system is busy.

Cheers,
Amin



The timer should compare the previous second with the current second and only update the display if it's changed. That way your timer isn't wasting cycles redrawing the same thing every time, but only when it changes.

hth,

Graham
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]

Amin Negm-Awad
[EMAIL PROTECTED]




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to