Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FSGetCatalogInfo returns mod dates in a deprecated data type: UTCDateTime




On Jan 17, 2007, at 2:34 PM, Chris Newman wrote:

You can manually convert the UTCDateTime to a double, then add kCFAbsoluteTimeIntervalSince1904 to get a CFAbsoluteTime. It'd look something like this:

(double) utcdt.highSeconds * UINT32_MAX + utcdt.lowSeconds
+ (double) utcdt.fraction / UINT16_MAX + kCFAbsoluteTimeIntervalSince1904;


The Unix standard/portable option is to use stat() to get file times (use FSRefMakePath to get the Posix path from an FSRef). You can then use standard strftime/localtime_r/etc on the time_t you get if those APIs are adequate, or convert it manually to a double, add kCFAbsoluteTimeIntervalSince1970 and you have a CFAbsoluteTime.

What's wrong with using UCConvertCFAbsoluteTimeToUTCDateTime and UCConvertUTCDateTimeToCFAbsoluteTime?


               - Chris

João Varela wrote on 1/12/07 19:56 +0000:

Hello All

I have been using UTCDateTime extensively because I thought that was the way
forward away from DateTimeRec but apparently that's not the case anymore as
(almost) everything to do with UTCDateTime has become deprecated in Tiger.

They're still supported and FSGetCatalogInfo has obviously not be deprecated -- nor will it cease to be supported anytime in the forseeable future -- so I wouldn't be fanatical about eliminating *all* reliance on UTCDateTime. You can just convert to and from CFAbsoluteTime when you need to.


Larry

As I am at the moment modernizing my code base I really want to move my code
to the recommended APIs (CFTimeZone, CFCalendar, etc.) but the fact that
FSGetCatalogInfo still returns mod and creation dates as UTCDateTime
variables prevents me from getting rid of this data type from my code as I
need to retrieve this information. Therefore, I have this question:


Is there a more modern way to retrieve a modification / creation date of a
given file / directory other than FSGetCatalogInfo? If so, please tell me
which, so that I can get rid of UTCDateTime. Or is that slated for Leopard?


TIA

JV

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/chris% 40greenhillroad.org


This email sent to email@hidden





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >FSGetCatalogInfo returns mod dates in a deprecated data type: UTCDateTime (From: João Varela <email@hidden>)
 >Re: FSGetCatalogInfo returns mod dates in a deprecated data type: UTCDateTime (From: Chris Newman <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.