Re: NSDate bug
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?