123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101 |
- {
- File: CarbonCore/DateTimeUtils.h
-
- Contains: International Date and Time Interfaces (previously in TextUtils)
-
- Copyright: © 1994-2011 by Apple Inc. All rights reserved.
-
- Bugs?: For bug reports, consult the following page on
- the World Wide Web:
-
- http://bugs.freepascal.org
-
- }
- {
- Modified for use with Free Pascal
- Version 308
- Please report any bugs to <[email protected]>
- }
- {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
- {$mode macpas}
- {$modeswitch cblocks}
- {$packenum 1}
- {$macro on}
- {$inline on}
- {$calling mwpascal}
- {$IFNDEF FPC_DOTTEDUNITS}
- unit DateTimeUtils;
- {$ENDIF FPC_DOTTEDUNITS}
- interface
- {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
- {$setc GAP_INTERFACES_VERSION := $0308}
- {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
- {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
- {$endc}
- {$ifc defined CPUPOWERPC and defined CPUI386}
- {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
- {$endc}
- {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
- {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
- {$endc}
- {$ifc not defined __ppc__ and defined CPUPOWERPC32}
- {$setc __ppc__ := 1}
- {$elsec}
- {$setc __ppc__ := 0}
- {$endc}
- {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
- {$setc __ppc64__ := 1}
- {$elsec}
- {$setc __ppc64__ := 0}
- {$endc}
- {$ifc not defined __i386__ and defined CPUI386}
- {$setc __i386__ := 1}
- {$elsec}
- {$setc __i386__ := 0}
- {$endc}
- {$ifc not defined __x86_64__ and defined CPUX86_64}
- {$setc __x86_64__ := 1}
- {$elsec}
- {$setc __x86_64__ := 0}
- {$endc}
- {$ifc not defined __arm__ and defined CPUARM}
- {$setc __arm__ := 1}
- {$elsec}
- {$setc __arm__ := 0}
- {$endc}
- {$ifc not defined __arm64__ and defined CPUAARCH64}
- {$setc __arm64__ := 1}
- {$elsec}
- {$setc __arm64__ := 0}
- {$endc}
- {$ifc defined cpu64}
- {$setc __LP64__ := 1}
- {$elsec}
- {$setc __LP64__ := 0}
- {$endc}
- {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
- {$error Conflicting definitions for __ppc__ and __i386__}
- {$endc}
- {$ifc defined __ppc__ and __ppc__}
- {$setc TARGET_CPU_PPC := TRUE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$elifc defined __ppc64__ and __ppc64__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := TRUE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$elifc defined __i386__ and __i386__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := TRUE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$ifc defined iphonesim}
- {$setc TARGET_OS_MAC := FALSE}
- {$setc TARGET_OS_IPHONE := TRUE}
- {$setc TARGET_IPHONE_SIMULATOR := TRUE}
- {$elsec}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$endc}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$elifc defined __x86_64__ and __x86_64__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := TRUE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$ifc defined iphonesim}
- {$setc TARGET_OS_MAC := FALSE}
- {$setc TARGET_OS_IPHONE := TRUE}
- {$setc TARGET_IPHONE_SIMULATOR := TRUE}
- {$elsec}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$endc}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$elifc defined __arm__ and __arm__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := TRUE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$setc TARGET_OS_MAC := FALSE}
- {$setc TARGET_OS_IPHONE := TRUE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$setc TARGET_OS_EMBEDDED := TRUE}
- {$elifc defined __arm64__ and __arm64__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := TRUE}
- {$ifc defined ios}
- {$setc TARGET_OS_MAC := FALSE}
- {$setc TARGET_OS_IPHONE := TRUE}
- {$setc TARGET_OS_EMBEDDED := TRUE}
- {$elsec}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$endc}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$elsec}
- {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
- {$endc}
- {$ifc defined __LP64__ and __LP64__ }
- {$setc TARGET_CPU_64 := TRUE}
- {$elsec}
- {$setc TARGET_CPU_64 := FALSE}
- {$endc}
- {$ifc defined FPC_BIG_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := TRUE}
- {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
- {$elifc defined FPC_LITTLE_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := FALSE}
- {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
- {$elsec}
- {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
- {$endc}
- {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
- {$setc CALL_NOT_IN_CARBON := FALSE}
- {$setc OLDROUTINENAMES := FALSE}
- {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
- {$setc OPAQUE_UPP_TYPES := TRUE}
- {$setc OTCARBONAPPLICATION := TRUE}
- {$setc OTKERNEL := FALSE}
- {$setc PM_USE_SESSION_APIS := TRUE}
- {$setc TARGET_API_MAC_CARBON := TRUE}
- {$setc TARGET_API_MAC_OS8 := FALSE}
- {$setc TARGET_API_MAC_OSX := TRUE}
- {$setc TARGET_CARBON := TRUE}
- {$setc TARGET_CPU_68K := FALSE}
- {$setc TARGET_CPU_MIPS := FALSE}
- {$setc TARGET_CPU_SPARC := FALSE}
- {$setc TARGET_OS_UNIX := FALSE}
- {$setc TARGET_OS_WIN32 := FALSE}
- {$setc TARGET_RT_MAC_68881 := FALSE}
- {$setc TARGET_RT_MAC_CFM := FALSE}
- {$setc TARGET_RT_MAC_MACHO := TRUE}
- {$setc TYPED_FUNCTION_POINTERS := TRUE}
- {$setc TYPE_BOOL := FALSE}
- {$setc TYPE_EXTENDED := FALSE}
- {$setc TYPE_LONGLONG := TRUE}
- {$IFDEF FPC_DOTTEDUNITS}
- uses MacOsApi.MacTypes,MacOsApi.UTCUtils,MacOsApi.CFDate;
- {$ELSE FPC_DOTTEDUNITS}
- uses MacTypes,UTCUtils,CFDate;
- {$ENDIF FPC_DOTTEDUNITS}
- {$endc} {not MACOSALLINCLUDE}
- {$ifc TARGET_OS_MAC}
- {$ALIGN MAC68K}
- {
- Here are the current routine names and the translations to the older forms.
- Please use the newer forms in all new code and migrate the older names out of existing
- code as maintainance permits.
-
- New Name Old Name(s)
-
- DateString IUDatePString IUDateString
- InitDateCache
- LongDateString IULDateString
- LongTimeString IULTimeString
- StringToDate String2Date
- StringToTime
- TimeString IUTimeString IUTimePString
- LongDateToSeconds LongDate2Secs
- LongSecondsToDate LongSecs2Date
- DateToSeconds Date2Secs
- SecondsToDate Secs2Date
- Carbon only supports the new names. The old names are undefined for Carbon targets.
- This is true for C, Assembly and Pascal.
-
- InterfaceLib always has exported the old names. For C macros have been defined to allow
- the use of the new names. For Pascal and Assembly using the new names will result
- in link errors.
-
- }
- type
- ToggleResults = SInt16;
- const
- { Toggle results }
- toggleUndefined = 0;
- toggleOK = 1;
- toggleBadField = 2;
- toggleBadDelta = 3;
- toggleBadChar = 4;
- toggleUnknown = 5;
- toggleBadNum = 6;
- toggleOutOfRange = 7; {synonym for toggleErr3}
- toggleErr3 = 7;
- toggleErr4 = 8;
- toggleErr5 = 9;
- const
- { Date equates }
- smallDateBit = 31; {Restrict valid date/time to range of Time global}
- togChar12HourBit = 30; {If toggling hour by AnsiChar, accept hours 1..12 only}
- togCharZCycleBit = 29; {Modifier for togChar12HourBit: accept hours 0..11 only}
- togDelta12HourBit = 28; {If toggling hour up/down, restrict to 12-hour range (am/pm)}
- genCdevRangeBit = 27; {Restrict date/time to range used by genl CDEV}
- validDateFields = -1;
- maxDateField = 10;
- const
- eraMask = $0001;
- yearMask = $0002;
- monthMask = $0004;
- dayMask = $0008;
- hourMask = $0010;
- minuteMask = $0020;
- secondMask = $0040;
- dayOfWeekMask = $0080;
- dayOfYearMask = $0100;
- weekOfYearMask = $0200;
- pmMask = $0400;
- dateStdMask = $007F; {default for ValidDate flags and ToggleDate TogglePB.togFlags}
- type
- LongDateField = SInt8;
- const
- eraField = 0;
- yearField = 1;
- monthField = 2;
- dayField = 3;
- hourField = 4;
- minuteField = 5;
- secondField = 6;
- dayOfWeekField = 7;
- dayOfYearField = 8;
- weekOfYearField = 9;
- pmField = 10;
- res1Field = 11;
- res2Field = 12;
- res3Field = 13;
- type
- DateForm = SInt8;
- const
- shortDate = 0;
- longDate = 1;
- abbrevDate = 2;
- const
- { StringToDate status values }
- fatalDateTime = $8000; { StringToDate and String2Time mask to a fatal error }
- longDateFound = 1; { StringToDate mask to long date found }
- leftOverChars = 2; { StringToDate & Time mask to warn of left over characters }
- sepNotIntlSep = 4; { StringToDate & Time mask to warn of non-standard separators }
- fieldOrderNotIntl = 8; { StringToDate & Time mask to warn of non-standard field order }
- extraneousStrings = 16; { StringToDate & Time mask to warn of unparsable strings in text }
- tooManySeps = 32; { StringToDate & Time mask to warn of too many separators }
- sepNotConsistent = 64; { StringToDate & Time mask to warn of inconsistent separators }
- tokenErr = $8100; { StringToDate & Time mask for 'tokenizer err encountered' }
- cantReadUtilities = $8200;
- dateTimeNotFound = $8400;
- dateTimeInvalid = $8800;
- type
- StringToDateStatus = SInt16;
- String2DateStatus = StringToDateStatus;
- DateCacheRecordPtr = ^DateCacheRecord;
- DateCacheRecord = packed record
- hidden: array [0..255] of SInt16; { only for temporary use }
- end;
- type
- DateCachePtr = DateCacheRecordPtr;
- DateTimeRecPtr = ^DateTimeRec;
- DateTimeRec = record
- year: SInt16;
- month: SInt16;
- day: SInt16;
- hour: SInt16;
- minute: SInt16;
- second: SInt16;
- dayOfWeek: SInt16;
- end;
- type
- LongDateTime = SInt64;
- LongDateTimePtr = ^LongDateTime;
- {$ifc TARGET_RT_BIG_ENDIAN}
- LongDateCvt = record
- case SInt16 of
- 0: (
- c: SInt64;
- );
- 1: (
- lHigh: UInt32;
- lLow: UInt32;
- );
- end;
- {$elsec}
- LongDateCvt = record
- case SInt16 of
- 0: (
- c: SInt64;
- );
- 1: (
- lLow: UInt32;
- lHigh: UInt32;
- );
- end;
- {$endc}
- LongDateCvtPtr = ^LongDateCvt;
- LongDateRecPtr = ^LongDateRec;
- LongDateRec = record
- case SInt16 of
- 0: (
- era: SInt16;
- year: SInt16;
- month: SInt16;
- day: SInt16;
- hour: SInt16;
- minute: SInt16;
- second: SInt16;
- dayOfWeek: SInt16;
- dayOfYear: SInt16;
- weekOfYear: SInt16;
- pm: SInt16;
- res1: SInt16;
- res2: SInt16;
- res3: SInt16;
- );
- 1: (
- list: array [0..13] of SInt16; {Index by LongDateField!}
- );
- 2: (
- eraAlt: SInt16;
- oldDate: DateTimeRec;
- );
- end;
- type
- DateDelta = SInt8;
- TogglePBPtr = ^TogglePB;
- TogglePB = record
- togFlags: SIGNEDLONG; {caller normally sets low word to dateStdMask=$7F}
- amChars: ResType; {from 'itl0', but uppercased}
- pmChars: ResType; {from 'itl0', but uppercased}
- reserved: array [0..3] of SInt32;
- end;
- {
- Conversion utilities between CF and Carbon time types.
- }
- {
- * UCConvertUTCDateTimeToCFAbsoluteTime()
- *
- * Discussion:
- * Use UCConvertUTCDateTimeToCFAbsoluteTime to convert from a
- * UTCDDateTime to a CFAbsoluteTime. Remember that the epoch for
- * UTCDateTime is January 1, 1904 while the epoch for CFAbsoluteTime
- * is January 1, 2001.
- *
- * Parameters:
- *
- * iUTCDate:
- * A pointer to a UTCDateTime struct that represents the time you
- * wish to convert from.
- *
- * oCFTime:
- * A pointer to a CFAbsoluteTime. On successful return, this will
- * contain the converted time from the input time type.
- *
- * Result:
- * A result code indicating whether or not conversion was successful.
- *
- * Availability:
- * Mac OS X: in version 10.2 and later in CoreServices.framework
- * CarbonLib: not available in CarbonLib 1.x
- * Non-Carbon CFM: not available
- }
- function UCConvertUTCDateTimeToCFAbsoluteTime( const (*var*) iUTCDate: UTCDateTime; var oCFTime: CFAbsoluteTime ): OSStatus; external name '_UCConvertUTCDateTimeToCFAbsoluteTime';
- (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
- {
- * UCConvertSecondsToCFAbsoluteTime()
- *
- * Discussion:
- * Use UCConvertSecondsToCFAbsoluteTime to convert from the normal
- * seconds representation of time to a CFAbsoluteTime. Remember that
- * the epoch for seconds is January 1, 1904 while the epoch for
- * CFAbsoluteTime is January 1, 2001.
- *
- * Parameters:
- *
- * iSeconds:
- * A UInt32 value that represents the time you wish to convert
- * from.
- *
- * oCFTime:
- * A pointer to a CFAbsoluteTime. On successful return, this will
- * contain the converted time from the input time type.
- *
- * Result:
- * A result code indicating whether or not conversion was successful.
- *
- * Availability:
- * Mac OS X: in version 10.2 and later in CoreServices.framework
- * CarbonLib: not available in CarbonLib 1.x
- * Non-Carbon CFM: not available
- }
- function UCConvertSecondsToCFAbsoluteTime( iSeconds: UInt32; var oCFTime: CFAbsoluteTime ): OSStatus; external name '_UCConvertSecondsToCFAbsoluteTime';
- (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
- {
- * UCConvertLongDateTimeToCFAbsoluteTime()
- *
- * Discussion:
- * Use UCConvertLongDateTimeToCFAbsoluteTime to convert from a
- * LongDateTime to a CFAbsoluteTime. Remember that the epoch for
- * LongDateTime is January 1, 1904 while the epoch for
- * CFAbsoluteTime is January 1, 2001.
- *
- * Parameters:
- *
- * iLongTime:
- * A LongDateTime value that represents the time you wish to
- * convert from.
- *
- * oCFTime:
- * A pointer to a CFAbsoluteTime. On successful return, this will
- * contain the converted time from the input time type.
- *
- * Result:
- * A result code indicating whether or not conversion was successful.
- *
- * Availability:
- * Mac OS X: in version 10.2 and later in CoreServices.framework
- * CarbonLib: not available in CarbonLib 1.x
- * Non-Carbon CFM: not available
- }
- function UCConvertLongDateTimeToCFAbsoluteTime( iLongTime: LongDateTime; var oCFTime: CFAbsoluteTime ): OSStatus; external name '_UCConvertLongDateTimeToCFAbsoluteTime';
- (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
- {
- * UCConvertCFAbsoluteTimeToUTCDateTime()
- *
- * Discussion:
- * Use UCConvertCFAbsoluteTimeToUTCDateTime to convert from a
- * CFAbsoluteTime to a UTCDateTime. Remember that the epoch for
- * UTCDateTime is January 1, 1904 while the epoch for CFAbsoluteTime
- * is January 1, 2001.
- *
- * Parameters:
- *
- * iCFTime:
- * A CFAbsoluteTime value that represents the time you wish to
- * convert from.
- *
- * oUTCDate:
- * A pointer to a UTCDateTime. On successful return, this will
- * contain the converted time from the CFAbsoluteTime input.
- *
- * Result:
- * A result code indicating whether or not conversion was successful.
- *
- * Availability:
- * Mac OS X: in version 10.2 and later in CoreServices.framework
- * CarbonLib: not available in CarbonLib 1.x
- * Non-Carbon CFM: not available
- }
- function UCConvertCFAbsoluteTimeToUTCDateTime( iCFTime: CFAbsoluteTime; var oUTCDate: UTCDateTime ): OSStatus; external name '_UCConvertCFAbsoluteTimeToUTCDateTime';
- (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
- {
- * UCConvertCFAbsoluteTimeToSeconds()
- *
- * Discussion:
- * Use UCConvertCFAbsoluteTimeToSeconds to convert from a
- * CFAbsoluteTime to a UInt32 representation of seconds. Remember
- * that the epoch for seconds is January 1, 1904 while the epoch for
- * CFAbsoluteTime is January 1, 2001.
- *
- * Parameters:
- *
- * iCFTime:
- * A CFAbsoluteTime value that represents the time you wish to
- * convert from.
- *
- * oSeconds:
- * A pointer to a UInt32. On successful return, this will contain
- * the converted time from the CFAbsoluteTime input.
- *
- * Result:
- * A result code indicating whether or not conversion was successful.
- *
- * Availability:
- * Mac OS X: in version 10.2 and later in CoreServices.framework
- * CarbonLib: not available in CarbonLib 1.x
- * Non-Carbon CFM: not available
- }
- function UCConvertCFAbsoluteTimeToSeconds( iCFTime: CFAbsoluteTime; var oSeconds: UInt32 ): OSStatus; external name '_UCConvertCFAbsoluteTimeToSeconds';
- (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
- {
- * UCConvertCFAbsoluteTimeToLongDateTime()
- *
- * Discussion:
- * Use UCConvertCFAbsoluteTimeToLongDateTime to convert from a
- * CFAbsoluteTime to a LongDateTime. Remember that the epoch for
- * LongDateTime is January 1, 1904 while the epoch for
- * CFAbsoluteTime is January 1, 2001.
- *
- * Parameters:
- *
- * iCFTime:
- * A CFAbsoluteTime value that represents the time you wish to
- * convert from.
- *
- * oLongDate:
- * A pointer to a LongDateTime. On successful return, this will
- * contain the converted time from the CFAbsoluteTime input.
- *
- * Result:
- * A result code indicating whether or not conversion was successful.
- *
- * Availability:
- * Mac OS X: in version 10.2 and later in CoreServices.framework
- * CarbonLib: not available in CarbonLib 1.x
- * Non-Carbon CFM: not available
- }
- function UCConvertCFAbsoluteTimeToLongDateTime( iCFTime: CFAbsoluteTime; var oLongDate: LongDateTime ): OSStatus; external name '_UCConvertCFAbsoluteTimeToLongDateTime';
- (* __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_NA) *)
- {$ifc not TARGET_CPU_64}
- {
- These routine are available in Carbon with their new name
- }
- {$ifc not TARGET_CPU_64}
- {
- * DateString() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFDateFormatterCreateStringWithDate instead
- *
- * Discussion:
- * This function is no longer recommended. Please use
- * CFDateFormatterCreateStringWithDate instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: not available
- }
- procedure DateString( dateTime: SInt32; longFlag: DateForm; var result: Str255; intlHandle: Handle ); external name '_DateString';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * TimeString() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFDateFormatterCreateStringWithDate instead
- *
- * Discussion:
- * This function is no longer recommended. Please use
- * CFDateFormatterCreateStringWithDate instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: not available
- }
- procedure TimeString( dateTime: SInt32; wantSeconds: Boolean; var result: Str255; intlHandle: Handle ); external name '_TimeString';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * LongDateString() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFDateFormatterCreateStringWithDate instead
- *
- * Discussion:
- * This function is no longer recommended. Please use
- * CFDateFormatterCreateStringWithDate instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: not available
- }
- procedure LongDateString( (*const*) var dateTime: LongDateTime; longFlag: DateForm; var result: Str255; intlHandle: Handle ); external name '_LongDateString';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * LongTimeString() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFDateFormatterCreateStringWithDate instead
- *
- * Discussion:
- * This function is no longer recommended. Please use
- * CFDateFormatterCreateStringWithDate instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: not available
- }
- procedure LongTimeString( (*const*) var dateTime: LongDateTime; wantSeconds: Boolean; var result: Str255; intlHandle: Handle ); external name '_LongTimeString';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- These routine are available in Carbon and InterfaceLib with their new name
- }
- {
- * InitDateCache() *** DEPRECATED ***
- *
- * Deprecated:
- * No longer needed on MacOS X.
- *
- * Discussion:
- * This function is obsolate.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- function InitDateCache( theCache: DateCachePtr ): OSErr; external name '_InitDateCache';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * StringToDate() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFDateFormatterCreateDateFromString instead
- *
- * Discussion:
- * This function is no longer recommended. Please use
- * CFDateFormatterCreateDateFromString instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- function StringToDate( textPtr: Ptr; textLen: SInt32; theCache: DateCachePtr; var lengthUsed: SInt32; var dateTime: LongDateRec ): StringToDateStatus; external name '_StringToDate';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * StringToTime() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFDateFormatterCreateDateFromString instead
- *
- * Discussion:
- * This function is no longer recommended. Please use
- * CFDateFormatterCreateDateFromString instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- function StringToTime( textPtr: Ptr; textLen: SInt32; theCache: DateCachePtr; var lengthUsed: SInt32; var dateTime: LongDateRec ): StringToDateStatus; external name '_StringToTime';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * LongDateToSeconds() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFCalendar instead.
- *
- * Discussion:
- * This function is no longer recommended. Please use CFCalendar
- * instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- procedure LongDateToSeconds( const (*var*) lDate: LongDateRec; var lSecs: LongDateTime ); external name '_LongDateToSeconds';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * LongSecondsToDate() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFCalendar instead.
- *
- * Discussion:
- * This function is no longer recommended. Please use CFCalendar
- * instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- procedure LongSecondsToDate( (*const*) var lSecs: LongDateTime; var lDate: LongDateRec ); external name '_LongSecondsToDate';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * ToggleDate() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFCalendar instead.
- *
- * Discussion:
- * This function is no longer recommended. Please use CFCalendar
- * instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- function ToggleDate( var lSecs: LongDateTime; field: LongDateField; delta: DateDelta; ch: SInt16; const (*var*) params: TogglePB ): ToggleResults; external name '_ToggleDate';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * ValidDate() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFCalendar instead.
- *
- * Discussion:
- * This function is no longer recommended. Please use CFCalendar
- * instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- function ValidDate( const (*var*) vDate: LongDateRec; flags: SIGNEDLONG; var newSecs: LongDateTime ): SInt16; external name '_ValidDate';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * ReadDateTime() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFAbsoluteTimeGetCurrent instead.
- *
- * Discussion:
- * This function is no longer recommended. Please use
- * CFAbsoluteTimeGetCurrent instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- function ReadDateTime( var datetime: UNSIGNEDLONG ): OSErr; external name '_ReadDateTime';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * GetDateTime() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFAbsoluteTimeGetCurrent instead.
- *
- * Discussion:
- * This function is no longer recommended. Please use
- * CFAbsoluteTimeGetCurrent instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- procedure GetDateTime( var secs: UNSIGNEDLONG ); external name '_GetDateTime';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * SetDateTime() *** DEPRECATED ***
- *
- * Deprecated:
- * deprecated it without replacement
- *
- * Discussion:
- * This function is no longer recommended. One has to be root on
- * MacOSX to set. This is done through other means on OS X
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- function SetDateTime( datetime: UNSIGNEDLONG ): OSErr; external name '_SetDateTime';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * SetTime() *** DEPRECATED ***
- *
- * Deprecated:
- * deprecated it without replacement
- *
- * Discussion:
- * This function is no longer recommended. One has to be root on
- * MacOSX to set. This is done through other means on OS X
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- procedure SetTime( const (*var*) d: DateTimeRec ); external name '_SetTime';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- * GetTime() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFAbsoluteTimeGetCurrent instead.
- *
- * Discussion:
- * This function is no longer recommended. Please use
- * CFAbsoluteTimeGetCurrent instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- procedure GetTime( var d: DateTimeRec ); external name '_GetTime';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {$endc} {not TARGET_CPU_64}
- {$ifc not TARGET_CPU_64}
- {
- * DateToSeconds() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFCalendar instead.
- *
- * Discussion:
- * This function is no longer recommended. Please use CFCalendar
- * instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- procedure DateToSeconds( const (*var*) d: DateTimeRec; var secs: UNSIGNEDLONG ); external name '_DateToSeconds';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {$endc} {not TARGET_CPU_64}
- {$ifc not TARGET_CPU_64}
- {
- * SecondsToDate() *** DEPRECATED ***
- *
- * Deprecated:
- * use CFCalendar instead.
- *
- * Discussion:
- * This function is no longer recommended. Please use CFCalendar
- * instead.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.3
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- procedure SecondsToDate( secs: UNSIGNEDLONG; var d: DateTimeRec ); external name '_SecondsToDate';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_3, __IPHONE_NA, __IPHONE_NA) *)
- {
- These routine are available in InterfaceLib using their old name.
- Macros allow using the new names in all source code.
-
- @deprecated use CFDateFormatter instead.
- }
- {
- * IUDateString() *** DEPRECATED ***
- *
- * Availability:
- * Mac OS X: not available [32-bit only] but deprecated in 10.3
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * IUTimeString() *** DEPRECATED ***
- *
- * Availability:
- * Mac OS X: not available [32-bit only] but deprecated in 10.3
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * IUDatePString() *** DEPRECATED ***
- *
- * Availability:
- * Mac OS X: not available [32-bit only] but deprecated in 10.3
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * IUTimePString() *** DEPRECATED ***
- *
- * Availability:
- * Mac OS X: not available [32-bit only] but deprecated in 10.3
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * IULDateString() *** DEPRECATED ***
- *
- * Availability:
- * Mac OS X: not available [32-bit only] but deprecated in 10.3
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * IULTimeString() *** DEPRECATED ***
- *
- * Availability:
- * Mac OS X: not available [32-bit only] but deprecated in 10.3
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {$endc} {not TARGET_CPU_64}
- {
- * iudatestring()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * iudatepstring()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * iutimestring()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * iutimepstring()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * iuldatestring()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {
- * iultimestring()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in InterfaceLib 7.1 and later
- }
- {$endc} {not TARGET_CPU_64}
- {$endc} {TARGET_OS_MAC}
- {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
- end.
- {$endc} {not MACOSALLINCLUDE}
|