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

Re: NSDate bug


  • Subject: Re: NSDate bug
  • From: email@hidden (mikevannorsdel)
  • Date: Mon, 26 Nov 2001 18:49:06 -0700

Ah thanks. That was the problem. Yes, I was getting the Unix epoch, from 1970.


On Monday, November 26, 2001, at 06:42 PM, John C. Randolph wrote:

According to <Foundation/NSDate.h>:

typedef double NSTimeInterval;

So you're storing a double in an unsigned long.

BTW, that header also declares:

#define NSTimeIntervalSince1970 978307200.0

So you could just use

NSTimeInterval secondsSinceUNIXEpoch = [[NSDate date] timeIntervalSinceReferenceDate] + NSTimeIntervalSince1970;


I'm a bit confused by your terminology. The "epoch" is the instant from which the date values are offsets, so the UNIX epoch is 00:00 hours, Jan 1, 1970, and the NSDate epoch is 00:00 hours, Jan 1, 2001.

Are you looking for the offset from the UNIX epoch, or from the NSDate epoch?


References: 
 >Re: NSDate bug (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: NSDate bug
  • Next by Date: Re: drawing pixels in NSView
  • Previous by thread: Re: NSDate bug
  • Next by thread: ANN: OCSmart Hacks alpha 1
  • Index(es):
    • Date
    • Thread