Re: Keeping NSTimeInterval updated with current time
Re: Keeping NSTimeInterval updated with current time
- Subject: Re: Keeping NSTimeInterval updated with current time
- From: Jens Alfke <email@hidden>
- Date: Mon, 2 Nov 2009 15:24:35 -0800
On Nov 2, 2009, at 3:10 PM, PCWiz wrote:
What I want to do is around every 5 minutes, update the timeInterval
to be consistent with the current time. The problem is that I need
to do this update for a large number of instances of the object. One
way I could think to do this would be to enumerate through the array
containing the objects every 5 minutes and just set the timeInterval
property. But is there a more efficient way to do this?
That sounds plenty efficient, unless you have tens of millions of
these objects. Assuming you only fetch the current date once (which is
somewhat expensive), the operation for each object is basically just
subtracting and storing the result in an instance variable. You're
talking about something on the order of a microsecond or less.
"Premature optimization is the root of all evil."
—Donald Knuth (?)
—Jens_______________________________________________
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