Re: UTCDateTime????
Re: UTCDateTime????
- Subject: Re: UTCDateTime????
- From: Rainer Brockerhoff <email@hidden>
- Date: Wed, 1 Aug 2001 20:59:59 -0300
>
Date: Wed, 1 Aug 2001 13:11:54 -0500
>
From: Brendan Younger <email@hidden>
>
>
Sorry to beat this to death, but I just had to deal with this yesterday
>
and my particular solution is:
>
>
UTCDateTime UTCdate;
>
NSDate* date, *scratch;
>
>
scratch = [NSDate dateWithString:@"1904-01-01 00:00:00 +0000"];
>
date = [[NSDate alloc] initWithTimeInterval:UTCDate.lowSeconds
>
sinceDate:scratch];
>
>
This and Brian's will be obsolete in the next few decades. (Oh boy, Y2K
>
again!)
Good idea to use a reference interval - it certainly looks much more self-documenting. But, you create an extra object (and probably should autorelease it :-)).
On second thought, don't you get an hour-off error when dealing with daylight saving time? I think calling ConvertUTCToLocalDateTime compensates for that automatically.
...and doing the old union trick, as in my initial suggestion, means it _won't_ be obsolete any time soon (or even later).
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
In their own business even sages err."
http://www.brockerhoff.net/ (updated July 2000)