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: Jeremy Dronfield <email@hidden>
- Date: Fri, 4 Jun 2004 17:39:51 +0100
On 4 Jun 2004, at 4:03 pm, Malte Tancred wrote:
Do you really need 'real' UTC, or is [NSDate date] enough?
Well, the user request is for UTC, so that's what I'm going by. As
previously posted, the code I've used is like so:
UTCDateTime *utcDateTime;
OSStatus error = GetUTCDateTime((UTCDateTime *)&utcDateTime,
kUTCDefaultOptions);
if (error == noErr) {
UInt16 high = utcDateTime->highSeconds;
UInt32 low = utcDateTime->lowSeconds;
UInt16 frac = utcDateTime->fraction;
NSLog(@"utcDateTime:%qu", utcDateTime);
NSLog(@"high:%hu", high);
NSLog(@"low:%u", low);
NSLog(@"fraction:%hu", frac);
//and including Andreas' suggestion:
NSLog(@"NSDate:%@", [[NSDate date] descriptionWithCalendarFormat:nil
timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0] locale:nil]);
}
Log output is:
utcDateTime:207696028500489
high:60280
low:2156157440
fraction:18435
NSDate:2004-06-04 16:30:24 +0000
Given that the user wants the ability to insert UTC in text (with a
format something like "000000 UTC"), what should I do here?
Thanks and regards,
-Jeremy
_______________________________________________
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.