On 22/08/2008, at 10:38 PM, Gregory Weston wrote:

Ron Fleckner wrote:

I want to display the current time in a full screen window.  I'm
making my computer into a digital clock (for my own use).  I've done
it by using NSCalendarDate and extracting the hours, minutes, and
seconds, formatting a string and displaying it.  I use an NSTimer to
update the display every half a second.

My question is: Is there a better way to display what is essentially
the same as the menu bar clock?

The menu bar uses the user's specified short date format, potentially adjusting for its own settings by controlling whether or not the string starts with the day-of-week and/or ends with AM/ PM indicator. I think the quickest route to get close to that is to use an NSDateFormatter with the time style set to NSDateFormatterShortStyle and the date style set to NSDateFormatterNoStyle. If you want to do the same fiddling that the menu bar does, you'll have to retrieve the actual format string from NSUserDefaults and tweak it ahead of time.

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.

Ron
_______________________________________________

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