Re: Observing Time
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