Re: Representing UTC time in a readable format
Re: Representing UTC time in a readable format
- Subject: Re: Representing UTC time in a readable format
- From: Creed Erickson <email@hidden>
- Date: Fri, 4 Jun 2004 14:15:55 -0700
On Friday, June 4, 2004, at 11:23 AM, Jeremy Dronfield wrote:
But then, as Malte pointed out, does NSDate handle leap-seconds
No, see Apple's docs.
http://developer.apple.com/documentation/Cocoa/Conceptual/
DatesAndTimes/Concepts/Dates.html
or the difference between UTC and "official" time? As in:
1997-06-30 23:59:59 UTC = 1997-07-01 00:00:29 TAI
1997-06-30 23:59:60 UTC = 1997-07-01 00:00:30 TAI (Example from
http://cr.yp.to/proto/utctai.html)
This is an apples and aardvarks comparison. "UTC" is a REPRESENTATION
standard for any date and time. "UTC" dates and times can be
leap-second corrected or not and still fit the representation standard.
To have a UTC formatted date, all you need do is apply an appropriate
format to an NSDate, as has been suggested. TAI is a standard for date
and time DATA. Comparing TIA to UTC is like comparing a specific word
to the font face it's presented in. It winds up being a nonsensical
comparison.
All of which is academic, however, since all I'm asking for is
guidance on how to turn the value returned by the Carbon function
GetUTCDateTime into a readable date.
This particular API is grossly misnamed as "UTC" is not a type of date
or time data, rather a specification for how to represent date and time
data. What GetUTCDateTime returns is Macintosh epoch time. (AKA, number
of seconds since 1904.) I cannot find any statement as to whether this
data is leap-second corrected or not. (If you have a such a reference,
I'd love to know about it, please.) While there are conversion
functions such as DateString and LongDateString, none appear to be in
the proper UTC format. Easier to use NSDate with a format, i.e.,
"%Y-%m-%d %H:%M:%SZ"
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.