Derived from | |
Framework | CoreFoundation/CoreFoundation.h |
Declared in | CFDate.h |
Companion guides |
CFDate objects store dates and times that can be compared to other dates and times. CFDate objects are immutable—there is no mutable counterpart for this opaque type.
CFDate provides functions for creating dates, comparing dates, and computing intervals. You use the CFDateCreate
function to create CFDate objects. You use the CFDateCompare
function to compare two dates, and the CFDateGetTimeIntervalSinceDate
function to compute a time interval. Additional functions for managing dates and times are described in Time Utilities Reference
CFDate is “toll-free bridged” with its Core Foundation counterpart, NSDate. What this means is that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. In other words, in a method where you see an NSDate *
parameter, you can pass in a CFDateRef
, and in a function where you see a CFDateRef
parameter, you can pass in an NSDate instance. This also applies to concrete subclasses of NSDate. See Interchangeable Data Types for more information on toll-free bridging.
Compares two CFDate objects and returns a comparison result.
CFComparisonResult CFDateCompare ( CFDateRef theDate, CFDateRef otherDate, void *context );
The date to compare to otherDate.
The date to compare to theDate.
Unused. Pass NULL
.
A CFComparisonResult
value that indicates whether theDate is equal to, less than, or greater than otherDate.
CFDate.h
Creates a CFDate object given an absolute time.
CFDateRef CFDateCreate ( CFAllocatorRef allocator, CFAbsoluteTime at );
The allocator to use to allocate memory for the new object. Pass NULL
or kCFAllocatorDefault
to use the current default allocator.
The absolute time to convert to a CFDate object.
A date object that represents the absolute time at. Ownership follows the Create Rule.
CFDate objects must always be created using absolute time. Time intervals are not supported.
CFDate.h
Returns a CFDate object’s absolute time.
CFAbsoluteTime CFDateGetAbsoluteTime ( CFDateRef theDate );
The date to examine.
The absolute time of theDate.
Absolute time is measured in seconds relative to the absolute reference date of Jan 1 2001 00:00:00 GMT. A positive value represents a date after the reference date, a negative value represents a date before it. For example, the absolute time -32940326 is equivalent to December 16th, 1999 at 17:54:34.
CFDate.h
Returns the number of elapsed seconds between the given CFDate objects.
CFTimeInterval CFDateGetTimeIntervalSinceDate ( CFDateRef theDate, CFDateRef otherDate );
The date to compare to otherDate.
The date to compare to theDate.
The number of elapsed seconds between theDate and otherDate. The result is positive if theDate is later than otherDate.
CFDate.h
Returns the type identifier for the CFDate opaque type.
CFTypeID CFDateGetTypeID ( void );
The type identifier for the CFDate opaque type.
CFDate.h
A reference to an immutable CFDate object.
typedef const struct __CFDate *CFDateRef;
CFDate.h
© 2003, 2005 Apple Computer, Inc. All Rights Reserved. (Last updated: 2005-12-06)