Changeset 43 for trunk/Cocoa/Pester/Source/PSAlarm.m
- Timestamp:
- 11/10/02 05:34:08 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSAlarm.m
r34 r43 9 9 #import "PSAlarm.h" 10 10 #import "PSAlert.h" 11 #import "NJRDateFormatter.h" 11 12 12 13 NSString * const PSAlarmTimerSetNotification = @"PSAlarmTimerSetNotification"; 13 14 NSString * const PSAlarmTimerExpiredNotification = @"PSAlarmTimerExpiredNotification"; 14 15 16 static NSString *dateFormat, *shortDateFormat, *timeFormat; 17 static NSDictionary *locale; 18 15 19 // XXX need to reset pending alarms after sleep, they "freeze" and never expire. 16 20 17 21 @implementation PSAlarm 22 23 + (void)initialize; // XXX change on locale modification, subscribe to NSNotifications 24 { 25 dateFormat = [[NJRDateFormatter localizedDateFormatIncludingWeekday: YES] retain]; 26 shortDateFormat = [[NJRDateFormatter localizedShortDateFormatIncludingWeekday: NO] retain]; 27 timeFormat = [[NJRDateFormatter localizedTimeFormatIncludingSeconds: YES] retain]; 28 locale = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] retain]; 29 } 18 30 19 31 - (void)dealloc; … … 153 165 } 154 166 167 - (NSString *)dateString; 168 { 169 return [[self date] descriptionWithCalendarFormat: dateFormat locale: locale]; 170 } 171 155 172 - (NSString *)shortDateString; 156 173 { 157 return [[self date] descriptionWithCalendarFormat: [[NSUserDefaults standardUserDefaults] stringForKey: NSShortDateFormatString]];174 return [[self date] descriptionWithCalendarFormat: shortDateFormat locale: locale]; 158 175 } 159 176 160 177 - (NSString *)timeString; 161 178 { 162 return [[self date] descriptionWithCalendarFormat: @"%1I:%M:%S %p"]; // XXX regular format doesn't work179 return [[self date] descriptionWithCalendarFormat: timeFormat locale: locale]; 163 180 } 164 181
Note:
See TracChangeset
for help on using the changeset viewer.