
Originally Posted by
NeonBoomBox
•12 hour clock w day of week
Without having actually downloaded it, here is one suggestion I have.
Don't force your date preferences on others 
Use one of the Date and Time formats from the International SysPrefs. That way the user can customize the format to look how ever they prefer (i'm a mm/dd/yy hh:mm:ss man myself
). Here is an example of how to do it (though I am being bad and forcing them to use a date):
Code:
- (void) updateDateTime: (id) ignore {
NSString *path = [@"~/Library/Preferences/.GlobalPreferences.plist"
stringByExpandingTildeInPath];
NSDictionary *prefs = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *dateFormat = [[prefs objectForKey:@"AppleICUDateFormatStrings"]
objectForKey:@"3"];
NSString *timeFormat = [[prefs objectForKey:@"AppleICUTimeFormatStrings"]
objectForKey:@"3"];
NSString *date, *time;
CFLocaleRef locale = NULL;
CFDateFormatterRef formatter = NULL;
if (dateFormat == nil) {
// Default if the user doesn't have anything configured.
// 2 digit month, 2 digit day, 2 digit year.
dateFormat = @"MM/dd/yy";
}
if (timeFormat == nil) {
// Default if the user doesn't have anything configured.
// 24 hour 2 digit hour, 2 digit minute, and 2 digit seconds.
timeFormat = @"HH:mm:ss";
}
locale = CFLocaleCopyCurrent();
formatter = CFDateFormatterCreate(kCFAllocatorDefault, locale,
kCFDateFormatterNoStyle,
kCFDateFormatterNoStyle);
CFDateFormatterSetFormat(formatter, (CFStringRef) dateFormat);
date = (NSString *) CFDateFormatterCreateStringWithAbsoluteTime(
kCFAllocatorDefault, formatter,
CFAbsoluteTimeGetCurrent());
CFDateFormatterSetFormat(formatter, (CFStringRef) timeFormat);
time = (NSString *) CFDateFormatterCreateStringWithAbsoluteTime(
kCFAllocatorDefault, formatter,
CFAbsoluteTimeGetCurrent());
CFRelease(locale);
CFRelease(formatter);
[dateTextField setStringValue:[NSString stringWithFormat:@"%@ %@",
date, time]];
}
Otherwise it sounds pretty good so far.
Do I recall correctly (from a previous thread) that you are not open sourcing this?
-dave
Bookmarks