• 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 11:02:34 +0100

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

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

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.

That doesn't agree with what Andy found in the docs, but if you're worried about that you can just avoid using a repeating timer and re-schedule it every time you've fired, correcting for any possible drift as you do so.

Oh, that's not the way I read it. I've just seen Andy's message and it said:


A repeating timer reschedules itself based on the scheduled firing time, not the actual firing time. For example, if a timer is scheduled to fire at a particular time and every 5 seconds after that, the scheduled firing time will always fall on the original 5 second time intervals, even if the actual firing time gets delayed.

This sounds to me like the repeats are offset from the schedule firing time rather than the actual time of firing, does it not?


So it sounds like what Uli really needs is to just once off construct a timer using - initWithFireDate:interval:target:selector:userInfo:repeats: to set the first timer off on the hour and then trigger at a 3600 second interval after that.

    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


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>)
 >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: Re: Adding 30 minutes to an NSDate
  • 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