资源描述:
《Date and Time Programming Guide for Core Foundation.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、DateandTimeProgrammingGuideforCoreFoundationContentsIntroductiontoDatesandTimesProgrammingGuideforCoreFoundation4WhoShouldReadThisDocument4OrganizationofThisDocument4DateRepresentations5CFAbsoluteTime5CFTimeInterval5CFGregorianDate6CFGregorianUnits6CFDate6TimeZones7UsingDates8DocumentRevisionHi
2、story102005-08-11
3、Copyright©2005AppleComputer,Inc.AllRightsReserved.2ListingsUsingDates8Listing1CreatingaCFDateobject8Listing2ComparingtwoCFDateobjects8Listing3WorkingwithGregoriandates92005-08-11
4、Copyright©2005AppleComputer,Inc.AllRightsReserved.3IntroductiontoDatesandTimesProgrammingGuideforC
5、oreFoundationCoreFoundationprovidesdateandtimeobjectsyoucanusewithoutdependingonoperating-systeminternals.WhoShouldReadThisDocumentYoushouldreadthisdocumenttolearnaboutrepresentationsofdateandtimeintheCoreFoundationframework,andhowtousethem.OrganizationofThisDocumentThistopicdiscussesthediffere
6、ntdateandtimerepresentations,issueswithtimezones,andcontainsexamplesonhowtousedateandtimeobjects:●“DateRepresentations”(page5)●“TimeZones”(page7)●“UsingDates”(page8)2005-08-11
7、Copyright©2005AppleComputer,Inc.AllRightsReserved.4DateRepresentationsCoreFoundationallowsyoutoworkwithfivedifferentrep
8、resentationsoftime:●CFAbsoluteTime,aspecificpointintimerelativeto1January200100:00:00GMT●CFTimeInterval,anintervaloftimeinseconds●CFGregorianDate,aspecificpointintimerepresentedusingtheGregoriancalender●CFGregorianUnits,anintervaloftimeinoneormoreoftheunitsusedintheGregoriancalendar●CFDate,anab
9、solutetimeintheformatofaCoreFoundationopaquetypeCFAbsoluteTimeCFAbsoluteTimeisusefulwhenyouneedtorefertoaspecificpointintime.ACFAbsoluteTimevaluerepresentstimeasanumberofsecondsrelativetothereferencedateof1January,200100:00:00GMT.Apositivevaluerepresentsadateafterthereferencedate,anegativevalue
10、representsadatebeforeit.Absolutetimecanbeconfusingatfirstbecauseanabsolutetimevalueisliterallyatimeinterval(thenumberofsecondssincethereferencedate),butitisinterpretedasaspecificinstantintime.Forexample,theabsolutetime-32940326ind