• 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: Representing UTC time in a readable format
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Representing UTC time in a readable format
      • From: Andreas Mayer <email@hidden>
References: 
 >Representing UTC time in a readable format (From: Jeremy Dronfield <email@hidden>)
 >Re: Representing UTC time in a readable format (From: j o a r <email@hidden>)
 >Re: Representing UTC time in a readable format (From: Jeremy Dronfield <email@hidden>)
 >Re: Representing UTC time in a readable format (From: Malte Tancred <email@hidden>)

  • Prev by Date: NSTextField and first responder - when does a feature become a bug?
  • Next by Date: Objective-C Question
  • Previous by thread: Re: Representing UTC time in a readable format
  • Next by thread: Re: Representing UTC time in a readable format
  • Index(es):
    • Date
    • Thread