| Derived from | |
| Framework | CoreFoundation/CoreFoundation.h |
| Companion guide | |
| Declared in | CFDate.h CFTimeZone.h |
CFTimeZone defines the behavior of time zone objects. Time zone objects represent geopolitical regions. Consequently, these objects have names for these regions. Time zone objects also represent a temporal offset, either plus or minus, from Greenwich Mean Time (GMT) and an abbreviation (such as PST for Pacific Standard Time).
CFTimeZone provides several functions to create time zone objects: CFTimeZoneCreateWithName and CFTimeZoneCreateWithTimeIntervalFromGMT. CFTimeZone also permits you to set the default time zone within your application using the CFTimeZoneSetDefault function. You can access this default time zone at any time with the CFTimeZoneCopyDefault function.
CFTimeZone is “toll-free bridged” with its Cocoa Foundation counterpart, NSTimeZone. This means that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. Therefore, in a method where you see an NSTimeZone * parameter, you can pass in a CFTimeZoneRef, and in a function where you see a CFTimeZoneRef parameter, you can pass in an NSTimeZone instance. This fact also applies to concrete subclasses of NSTimeZone. See Interchangeable Data Types for more information on toll-free bridging.
CFTimeZoneCopyAbbreviationDictionary
CFTimeZoneCopyAbbreviation
CFTimeZoneCopyDefault
CFTimeZoneCopySystem
CFTimeZoneSetDefault
CFTimeZoneCopyKnownNames
CFTimeZoneResetSystem
CFTimeZoneSetAbbreviationDictionary
CFTimeZoneIsDaylightSavingTime
CFTimeZoneGetDaylightSavingTimeOffset
CFTimeZoneGetNextDaylightSavingTimeTransition
Returns the abbreviation of a time zone at a specified date.
CFStringRef CFTimeZoneCopyAbbreviation ( CFTimeZoneRef tz, CFAbsoluteTime at );
The time zone to use.
The absolute time at which to obtain the abbreviation.
A string containing the time zone abbreviation of at. Ownership follows the Create Rule.
Note that the abbreviation may be different at different dates. For example, during daylight savings time the US/Eastern time zone has an abbreviation of "EDT." At other times, its abbreviation is "EST."
CFTimeZone.h
Returns a dictionary holding the mappings of time zone abbreviations to time zone names.
CFDictionaryRef CFTimeZoneCopyAbbreviationDictionary ( void );
A dictionary containing the mappings of time zone abbreviations to time zone names. Ownership follows the Create Rule.
More than one time zone may have the same abbreviation. For example, US/Pacific and Canada/Pacific both use the abbreviation "PST." In these cases this function chooses a single name to map the abbreviation to.
CFTimeZone.h
Returns the default time zone set for your application.
CFTimeZoneRef CFTimeZoneCopyDefault ( void );
A time zone representing the default time zone set for your application, or the system time zone if no default is set. Ownership follows the Create Rule.
If no default time zone is set, this function simply returns the result of the CFTimeZoneCopySystem function.
CFTimeZone.h
Returns an array of strings containing the names of all the time zones known to the system.
CFArrayRef CFTimeZoneCopyKnownNames ( void );
An array containing CFString objects representing all the known time zone names. Ownership follows the Create Rule.
CFTimeZone.hReturns the localized name of a given time zone.
CFStringRef CFTimeZoneCopyLocalizedName ( CFTimeZoneRef tz, CFTimeZoneNameStyle style, CFLocaleRef locale );
The time zone to analyze.
The style for the returned name.
The locale for which to localize the returned name.
The name of tz localized for locale.Ownership follows the Create Rule.
CFTimeZone.h
Returns the time zone currently used by the system.
CFTimeZoneRef CFTimeZoneCopySystem ( void );
A time zone representing the time zone currently used by the system, or the GMT time zone if the current zone cannot be determined. Ownership follows the Create Rule.
CFTimeZone.h
Creates a time zone with a given name and data.
CFTimeZoneRef CFTimeZoneCreate ( CFAllocatorRef allocator, CFStringRef name, CFDataRef data );
The allocator object to use to allocate memory for the new time zone. Pass NULL or kCFAllocatorDefault to use the current default allocator.
The name of the time zone to create.
The data to use to initialize the time zone. The contents of the data should be the same as that found within the time-zone files located at /usr/share/zoneinfo.
A time zone corresponding to name and data. Ownership follows the Create Rule.
You typically do not call this function directly. Use the CFTimeZoneCreateWithName function to obtain a time zone given its name.
CFTimeZone.h
Returns the time zone object identified by a given name or abbreviation.
CFTimeZoneRef CFTimeZoneCreateWithName ( CFAllocatorRef allocator, CFStringRef name, Boolean tryAbbrev );
The allocator object to use to allocate memory for the new time zone. Pass NULL or kCFAllocatorDefault to use the current default allocator.
The name or abbreviation of the time zone to obtain. The name may be in any of the formats understood by the system, for example "EST", "Etc/GMT-2", "America/Argentina/Buenos_Aires", "Europe/Monaco", "US/Pacific", or "posixrules". For a complete list of system names, you can see the output of CFTimeZoneCopyKnownNames.
If false, assumes name is not an abbreviation and searches the time zone information directory for a matching name. If true, tries to resolve name using the abbreviation dictionary first before searching the information dictionary.
A time zone corresponding to name, or NULL if no match was found. Ownership follows the Create Rule.
CFTimeZone.h
Returns a time zone object for the specified time interval offset from Greenwich Mean Time (GMT).
CFTimeZoneRef CFTimeZoneCreateWithTimeIntervalFromGMT ( CFAllocatorRef allocator, CFTimeInterval ti );
The allocator object to use to allocate memory for the new time zone. Pass NULL or kCFAllocatorDefault to use the current default allocator.
The offset, from GMT, of the new time zone.
A new time zone whose offset from GMT is given by the interval ti. The name of the new time zone is GMT +/- the offset, in hours and minutes. Time zones created with this function never have daylight savings, and the offset is constant no matter what the date. Ownership follows the Create Rule.
CFTimeZone.h
Returns the data that stores the information used by a time zone.
CFDataRef CFTimeZoneGetData ( CFTimeZoneRef tz );
The time zone to analyze.
The data used to store tz. Ownership follows the Get Rule.
CFTimeZone.hReturns the daylight saving time offset for a time zone at a given time.
CFTimeInterval CFTimeZoneGetDaylightSavingTimeOffset ( CFTimeZoneRef tz, CFAbsoluteTime at );
The time zone to analyze.
The time in tz to test for daylight saving time offset.
The daylight saving time offset for tz at at.
CFTimeZone.h
Returns the geopolitical region name that identifies a given time zone.
CFStringRef CFTimeZoneGetName ( CFTimeZoneRef tz );
The time zone to analyze.
A string containing the geopolitical region name that identifies tz. Ownership follows the Get Rule.
CFTimeZone.hReturns the time in a given time zone of the next daylight saving time transition after a given time.
CFAbsoluteTime CFTimeZoneGetNextDaylightSavingTimeTransition ( CFTimeZoneRef tz, CFAbsoluteTime at );
The time zone to analyze.
A time in tz.
The time in tz of the next daylight saving time transition after at.
CFTimeZone.h
Returns the difference in seconds between the receiver and Greenwich Mean Time (GMT) at the specified date.
CFTimeInterval CFTimeZoneGetSecondsFromGMT ( CFTimeZoneRef tz, CFAbsoluteTime at );
The time zone to analyze.
The date at which the interval is to be computed.
The difference in seconds between tz and GMT at the specified date, at.
CFTimeZone.h
Returns the type identifier for the CFTimeZone opaque type.
CFTypeID CFTimeZoneGetTypeID ( void );
The type identifier for the CFTimeZone opaque type.
CFTimeZone.h
Returns whether or not a time zone is in daylight savings time at a specified date.
Boolean CFTimeZoneIsDaylightSavingTime ( CFTimeZoneRef tz, CFAbsoluteTime at );
The time zone to analyze.
The date in tz to test for daylight savings.
true if tz is in daylight savings time at at, otherwise false.
CFTimeZone.h
Clears the previously determined system time zone, if any.
void CFTimeZoneResetSystem ( void );
This function also resets the default time zone if it is the same as the system time zone.
Subsequent calls to CFTimeZoneCopySystem will attempt to re-determine the system time zone.
CFTimeZone.h
Sets the abbreviation dictionary to a given dictionary.
void CFTimeZoneSetAbbreviationDictionary ( CFDictionaryRef dict );
A dictionary containing key-value pairs for looking up time zone names given their abbreviations. The keys should be CFString objects containing the abbreviations; the values should be CFString objects containing their corresponding geopolitical region names.
CFTimeZone.h
Sets the default time zone for your application the given time zone.
void CFTimeZoneSetDefault ( CFTimeZoneRef tz );
The time zone to use as default.
There can be only one default time zone, so by setting a new default time zone, you lose the previous one.
CFTimeZone.hPara
typedef CFIndex CFTimeZoneNameStyle;
For values, see “Time Zone Name Styles.”
CFTimeZone.hA reference to a CFTimeZone object.
typedef const struct __CFTimeZone *CFTimeZoneRef;
CFDate.hName of the notification posted when the time zone changes.
const CFStringRef kCFTimeZoneSystemTimeZoneDidChangeNotification;
kCFTimeZoneSystemTimeZoneDidChangeNotificationName of the notification posted when the system time zone changes.
The object of the notification is the previous system time zone object. This notification carries no user info.
Keep in mind that there is no order in how notifications are delivered to observers; frameworks or other parts of your code may also be observing this notification to take their own actions, and these may not have occurred by the time you receive the notification.
Available in Mac OS X v10.5 and later.
Declared in CFTimeZone.h
CFTimeZone.hConstants to specify styles for time zone names.
enum {
kCFTimeZoneNameStyleStandard,
kCFTimeZoneNameStyleShortStandard,
kCFTimeZoneNameStyleDaylightSaving,
kCFTimeZoneNameStyleShortDaylightSaving
};
kCFTimeZoneNameStyleStandardSpecifies the standard name style for a time zone.
Available in Mac OS X v10.5 and later.
Declared in CFTimeZone.h
kCFTimeZoneNameStyleShortStandardSpecifies the short standard name style for a time zone.
Available in Mac OS X v10.5 and later.
Declared in CFTimeZone.h
kCFTimeZoneNameStyleDaylightSavingSpecifies the daylight saving name style for a time zone.
Available in Mac OS X v10.5 and later.
Declared in CFTimeZone.h
kCFTimeZoneNameStyleShortDaylightSavingSpecifies the short daylight saving name style for a time zone.
Available in Mac OS X v10.5 and later.
Declared in CFTimeZone.h
These constants are used with the function CFTimeZoneCopyLocalizedName.
CFTimeZone.h
Last updated: 2007-05-23