• 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: Observing Time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Observing Time


  • Subject: Re: Observing Time
  • From: Andy Lee <email@hidden>
  • Date: Sat, 27 Jul 2013 21:10:04 -0400

On Jul 27, 2013, at 7:53 PM, email@hidden wrote:
> I just tried both approaches and guess which one stays right there with the menu bar clock and which one lags?
> dispatch timer is the winner.
> And it's not doing a lot.
>
> I built a test app for each approach to verify.

Is it possible there's a difference in how you're doing the math in the two cases, such that the NSTimer case might be firing *early* rather than late?  Say the first NSTimer fires a little before the time you intended -- for example, it fires at 00:36.9999 instead of 00:37.  Your UI will not get around to displaying the 37 until possibly a whole second later, depending on how you set up the firing of the next timer.

If I were using an NSTimer approach I might set it to fire at .001 past the second just to be sure I don't get caught by rounding error in my floating-point math.

--Andy


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >Observing Time (From: email@hidden)
 >Re: Observing Time (From: Rick Mann <email@hidden>)
 >Re: Observing Time (From: email@hidden)
 >Re: Observing Time (From: Ken Thomases <email@hidden>)
 >Re: Observing Time (From: email@hidden)
 >Re: Observing Time (From: Ken Thomases <email@hidden>)
 >Re: Observing Time (From: email@hidden)
 >Re: Observing Time (From: Ken Thomases <email@hidden>)
 >Re: Observing Time (From: email@hidden)
 >Re: Observing Time (From: Scott Ribe <email@hidden>)
 >Re: Observing Time (From: email@hidden)
 >Re: Observing Time (From: Kyle Sluder <email@hidden>)
 >Re: Observing Time (From: email@hidden)

  • Prev by Date: Re: Observing Time
  • Next by Date: Re: Observing Time
  • Previous by thread: Re: Observing Time
  • Next by thread: Re: Observing Time
  • Index(es):
    • Date
    • Thread