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



Hi Chris, Larry

I knew about converting UTCDateTime to CFAbsoluteTime; that was not the problem, although I do appreciate the fact that you replied to my question. What I asked was a way to get rid of UTCDateTime data type completely by using a more modern API than FSGetCatalogInfo, but I guess the "deafening silence" concerning my question means there is none at the moment. :) Therefore I was planning to use the APIs that Larry suggested, although it's good to know that you can do that manually if you wish. :) I could file a bug but I guess Apple is perfectly aware of that problem when they declared UTCDateTime deprecated in Tiger. The "deafening silence" is quite understandable. :)

JV



On 2007/01/17, at 20:50, Laurence Harris wrote:


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>)
 >Re: FSGetCatalogInfo returns mod dates in a deprecated data type: UTCDateTime (From: Laurence Harris <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.