• 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
Re: Adding 30 minutes to an NSDate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding 30 minutes to an NSDate


  • Subject: Re: Adding 30 minutes to an NSDate
  • From: Nicko van Someren <email@hidden>
  • Date: Wed, 20 Jul 2005 10:11:46 +0100

On 20 Jul 2005, at 10:02, j o a r wrote:

On 20 jul 2005, at 10.54, Nicko van Someren wrote:

You don't want to just fire after 60 mins from when your last timer function was triggered. NSTimers can fire late, especially if the machine is asleep at the time that the timer was supposed to fire, so firing at Now+60mins will tend to drift; if you want the timer to go off on the hour where possible this will be bad.


You would of course re-schedule your timers whenever you wake up from sleep. That's something you always need to do when you use NSTimer to fire at an absolute time, and not really particular to how you choose to tackle this problem.

Agreed, but firing at Now + constant will inevitably drift even if you're not sleeping, so I can see why Uli wanted to add the constant to the last firing time rather than just wait for an hour from now. As I recall the docs even comment on this and point out that repeating timers fire at an offset from the scheduled time rather than the actual time, to avoid this problem.


    Cheers,
        Nicko


_______________________________________________ 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: Adding 30 minutes to an NSDate
      • From: j o a r <email@hidden>
References: 
 >Adding 30 minutes to an NSDate (From: Uli Kusterer <email@hidden>)
 >Re: Adding 30 minutes to an NSDate (From: j o a r <email@hidden>)
 >Re: Adding 30 minutes to an NSDate (From: Nicko van Someren <email@hidden>)
 >Re: Adding 30 minutes to an NSDate (From: j o a r <email@hidden>)

  • Prev by Date: /.journal_info_block
  • Next by Date: Re: Adding 30 minutes to an NSDate
  • Previous by thread: Re: Adding 30 minutes to an NSDate
  • Next by thread: Re: Adding 30 minutes to an NSDate
  • Index(es):
    • Date
    • Thread