NSTimer not firing if date changed in Sys Prefs
NSTimer not firing if date changed in Sys Prefs
- Subject: NSTimer not firing if date changed in Sys Prefs
- From: "Sean McBride" <email@hidden>
- Date: Wed, 30 Mar 2005 23:31:32 -0500
Hi all,
If I create an NSTimer scheduled to fire at a particular NSDate, add it
to the runloop, then change the date in System Preferences, the timer
does not fire at the right time. Has anyone else seen this? I create my
timer like so:
NSCalendarDate* now = [NSCalendarDate calendarDate];
NSCalendarDate* almostMidnight =
[NSCalendarDate dateWithYear:
[now yearOfCommonEra]
month:[now monthOfYear]
day:[now dayOfMonth]
hour:23
minute:59
second:59
timeZone:[now timeZone]];
NSTimer* timer = [[NSTimer alloc]
initWithFireDate:almostMidnight
interval:0.0f
target:self
selector:@selector(handleDayChange:)
userInfo:nil
repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:timer
forMode:NSDefaultRunLoopMode];
So say I run the above code at 22:00, then change the clock to 23:59, my
timer does not fire a minute later.
Am I expecting too much? :)
Thanks!
--
"How much harm does a company have to do before we question its right to
exist?" -- Paul Hawken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden