Re: Displaying time
Re: Displaying time
- Subject: Re: Displaying time
- From: Ron Fleckner <email@hidden>
- Date: Fri, 22 Aug 2008 22:55:26 +1000
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 (email@hidden)
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:
This email sent to email@hidden