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

Representing UTC time in a readable format


  • Subject: Representing UTC time in a readable format
  • From: Jeremy Dronfield <email@hidden>
  • Date: Fri, 4 Jun 2004 10:59:23 +0100

I'd like to be able to insert a time readout represented as UTC time in my text. Since there doesn't appear to be a Cocoa way to do it, I'm doing this to get the UTC date/time:

UTCDateTime *utcDateTime;
OSStatus error = GetUTCDateTime((UTCDateTime *)&utcDateTime, kUTCDefaultOptions);
UInt16 high = utcDateTime->highSeconds;
UInt32 low = utcDateTime->lowSeconds;

NSLog(@"utcDateTime:%qu", utcDateTime);
NSLog(@"high:%hu", high);
NSLog(@"low:%u", low);

which gives me a log output like this:

utcDateTime:207691733533048
high:997
low:3040632576

How can I translate this into a standard human-readable representation of UTC time? I'm not clear about the relationship between the high and low bits, and which I should use.

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: j o a r <email@hidden>
  • Prev by Date: Re: Are Bindings Redundant?
  • Next by Date: Re: Representing UTC time in a readable format
  • Previous by thread: Re: Subclassing NSCell: Checkbox and Text?
  • Next by thread: Re: Representing UTC time in a readable format
  • Index(es):
    • Date
    • Thread