• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTimer not firing if date changed in Sys Prefs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTimer not firing if date changed in Sys Prefs
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: Populating a NSTableView. Almost There....
  • Next by Date: Re: NSConcreteNotifyingMutableAttributedString
  • Previous by thread: Re: trouble getting c-chars from NSString
  • Next by thread: Re: NSTimer not firing if date changed in Sys Prefs
  • Index(es):
    • Date
    • Thread