• 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 09:54:00 +0100

On 20 Jul 2005, at 8:24, j o a r wrote:

On 20 jul 2005, at 09.14, Uli Kusterer wrote:
I have an app that announces the time every hour. For that, I'm setting a Timer's next fire time to an NSCalendarDate after each announcement. Now the problem is the wrap-over from 23:00 to 0:00, where I'd also have to add 1 to the day and, if that day is at the end of the month, I'd also have to add to the month.

Do you really have to care about all that, if all you want is to chime every hour? Why not simply set a timer to fire in 60 minutes, regardless of which calendar day that happens to be?

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.


    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: Andy Lee <email@hidden>
    • 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>)

  • Prev by Date: Re: NSTableView: Image and text in one column.
  • 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