• 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: Trouble comparing NSCalendarDates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble comparing NSCalendarDates


  • Subject: Re: Trouble comparing NSCalendarDates
  • From: Tito Ciuro <email@hidden>
  • Date: Mon, 15 Nov 2004 13:52:27 +0100

On Nov 15, 2004, at 13:29, j o a r wrote:

But you didn't answer my question - does the string that you restore contain the sub-second information? If the information is not in the string, it can't be restored - do you see what I'm saying?

I thought I had answered your question with my last code snippet. Sorry about that. To answer your question, yes, I have appended the interval to the string, so when I later extract this string, I can also obtain the interval as well.


This is why I was trying to create a date with the restored string (except the interval, since the conversion wouldn't work), then extract the interval, and finish by calling 'addTimeInterval' to add the missing sub-second info.

Note that the difference in time now is less than the precision provided by the string format.
As it is a floating point value you can't rely on getting exactly zero.

I see...

So I guess it's impossible to store a date and later recreate a perfect copy, correct? I was hoping that adding the extra sub-second info to the date would end up making it the same as the original date. I understand that a minor floating-point difference renders this equality impossible, but not being able to compare two *almost exact" dates with isEqualToDate is unfortunate. Sure, I can always refer developers to this Apple page, which explains how to compare dates:

http://developer.apple.com/documentation/Cocoa/Conceptual/ DatesAndTimes/Tasks/ComparingDates.html

Thanks a lot, Joar. I appreciate your help.

Best regards,

-- Tito

_______________________________________________
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: Trouble comparing NSCalendarDates
      • From: j o a r <email@hidden>
References: 
 >Trouble comparing NSCalendarDates (From: Tito Ciuro <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: j o a r <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: Tito Ciuro <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: j o a r <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: Tito Ciuro <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: Tito Ciuro <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: j o a r <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: Tito Ciuro <email@hidden>)
 >Re: Trouble comparing NSCalendarDates (From: j o a r <email@hidden>)

  • Prev by Date: Re: Multi-Page TIFF routine
  • Next by Date: Re: How to embed a popup menu in an NSTextField
  • Previous by thread: Re: Trouble comparing NSCalendarDates
  • Next by thread: Re: Trouble comparing NSCalendarDates
  • Index(es):
    • Date
    • Thread