Re: NSDate isEqual to...
Re: NSDate isEqual to...
- Subject: Re: NSDate isEqual to...
- From: mm w <email@hidden>
- Date: Fri, 20 Mar 2009 15:46:28 -0700
Right the comment of Mike is fair,
I don't know what you are doing (a lie), anyway your interest is to
know a time interval rather than a date
you should design a object with a referential start-time:
CFAbsoluteTime timeNow(void)
{
return (CFAbsoluteTime) (CFAbsoluteTimeGetCurrent() -
kCFAbsoluteTimeIntervalSince1970);
// you have similar access thru Cocoa
}
and use only NSDate (rather than to play with it, it's also a main
memory consumer) to make a representation of this time interval at
(T), I think it will save you a lot of pain
for the next time... :)
Cheers!
On Fri, Mar 20, 2009 at 2:50 PM, Mike Abdullah
<email@hidden> wrote:
>
> On 20 Mar 2009, at 21:17, Charles E. Heizer wrote:
>
>> Thanks,
>> No it's just playing around right now. It would be nice to be able to
>> specify if you wanted NSDate to be sub-second or second precision based.
>>
>> Just as question, can NSDate be overridden to be second precision based?
>
> Theoretically yes. Practically, it would be a rather bad idea. 1 second is
> meaningful to you, but consider a completely different culture's calendaring
> system where "a second" is actually equivalent to 3 of ours seconds. What
> would second precision be then?
>
> The point is that you don't really want to test the equality of two dates.
> Instead you want to compare them like so:
>
> date1 >= date2
> date1 <= date2
>
> Or you want to know if they're roughly equal to each other. "Is date1 within
> 0.5 seconds of date2"
>
> _______________________________________________
>
> 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
>
--
-mmw
_______________________________________________
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