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

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)


  • Follow-Ups:
    • Re: UTCDateTime????
      • From: Brendan Younger <email@hidden>
  • Prev by Date: Re: Need Help with Help (Help Viewer now dies..)
  • Next by Date: Re: cocoa-dev digest, Vol 1 #345 - 15 msgs
  • Previous by thread: Re: UTCDateTime????
  • Next by thread: Re: UTCDateTime????
  • Index(es):
    • Date
    • Thread