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

Re: Dates


  • Subject: Re: Dates
  • From: Peter Ammon <email@hidden>
  • Date: Thu, 6 Sep 2001 13:42:43 -0400

On Thursday, September 6, 2001, at 08:30 AM, rsharp wrote:

On Thu, 6 Sep 2001, Angela Brett wrote:

Hello,

I was looking through the NSDate docs trying to figure out how to get
the NSString representations of a date (which I eventually found in
NSCalendarDate) but I saw something which I'm a little curious about:


Principal Attributes
 Seconds since absolute reference date (1 January, 2001, GMT)


I thought most UNIX systems used 1970 for that... is Mac OS X ticking
different because it's nice and modern, or is it just the NSDate
class which stores the date differently? I notice there is a method
which returns the time interval since 1 January 1970, GMT, but that
is just called a reference date and not the absolute reference date.

IIRC, this was done to extend the expiration date a bit where we'd hit
that 2-billion seconds since EPOC. I think this reference can be added to
and taken away from to represent dates in either direction (i.e. before
and after 1-Jan-2001). I may be wrong though.


BSD does indeed use a signed long type to represent dates, which means it will overflow in 2038 or so. But Core Foundation uses a double type, and I'd expect that NSDate works the same way. This means that Core Foundation can represent something like 10^300 seconds, so overflow simply isn't an issue.

I'd guess that Apple chose a starting date close to the dates we are likely to represent to maximize the precision of the floating point type.

-Peter


  • Follow-Ups:
    • Re: Dates
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: address of method in a class instance
  • Next by Date: Re: Phantom views? was RE: [Newbie] Uninitialized outlets?
  • Previous by thread: Re: Dates
  • Next by thread: Re: Dates
  • Index(es):
    • Date
    • Thread