Re: NSTimer not firing if date changed in Sys Prefs
Re: NSTimer not firing if date changed in Sys Prefs
- Subject: Re: NSTimer not firing if date changed in Sys Prefs
- From: Douglas Norton <email@hidden>
- Date: Thu, 31 Mar 2005 15:42:07 +0100
On 31 Mar 2005, at 15:10, Sean McBride wrote:
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? :)
I wouldn't say so. While it may be a very rare case that the user
changes their time, it may happen twice a year automatically
depending on
if the time will auto-adjust for daylight savings.
Well I've filed a bug. At the very least I think the documentation
should be clearer. For initWithFireDate: it says "Initializes a new
NSTimer that, when added to a run loop, will fire at 'date'...". But
it
doesn't quite do that. :) It probably computes the interval from now to
'date' then calls timerWithTimeInterval.
From your description of the problem, I would agree with your
conclusion.
To workaround, you could install a timer that fires after a minute but
only does the meaningful thing when the original fire time has passed,
and otherwise requeues itself a minute later.
The downside is that if you have several tasks to perform, and the Mac
is put to sleep during the period when they should have fired, all
those tasks get triggered simultaneously once the Mac awakes.
Douglas
_______________________________________________
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