When the Mac sleeps, the timer sleeps as well and delays the fire time. I wrote my own class for this sort of thing and when it gets the wakeup notification, it re-schedules the timer or executes it immediately. It has a lot more options for that behavior (maybe it should skip, for example).
> On Apr 29, 2016, at 3:23 AM, Gerriet M. Denkmann <gerr...@mdenkmann.de> wrote: > > OS X 10.11.4; Xcode Version 7.3 (7D175). > > self.timer = [ NSTimer scheduledTimerWithTimeInterval: 900 … repeats: YES ]; > self.timer.fireDate = [ NSDate dateWithTimeIntervalSinceNow: 2222 ]; > > works fine without sleep. > > But: > fireDate: Fri 29 Apr 2016 15:06:14 +0700 in 37.03 min +900 sec > > Fri 29 Apr 2016 14:38:39 +0700 Wake. > fireDate: Fri 29 Apr 2016 15:06:14 +0700 in 27.57 min +900 sec > > Fri 29 Apr 2016 14:55:10 +0700 Wake. > fireDate: Fri 29 Apr 2016 15:06:14 +0700 in 11.05 min +900 sec > > Fri 29 Apr 2016 15:08:35 +0700 Wake. > fireDate: Fri 29 Apr 2016 15:06:14 +0700 LATE 141.8 sec +900 sec > > Fri 29 Apr 2016 15:26:31 +0700 Check. > fireDate: Fri 29 Apr 2016 15:06:14 +0700 LATE 1217.8 sec +900 sec > > I would expect the timer to fire rather soon now, but it never does. > The timer is not nil, is not invalid and has the correct fire time. > > What am I doing wrong? > > Gerriet. Alex Kac - El capitán _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com