2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 Copyright (c) 1998-2003, Apple, Inc. All rights reserved.
29 #if !defined(__COREFOUNDATION_CFDATE__)
30 #define __COREFOUNDATION_CFDATE__ 1
32 #include <CoreFoundation/CFBase.h>
34 #if defined(__cplusplus)
38 typedef double CFTimeInterval
;
39 typedef CFTimeInterval CFAbsoluteTime
;
40 /* absolute time is the time interval since the reference date */
41 /* the reference date (epoch) is 00:00:00 1 January 2001. */
44 CFAbsoluteTime
CFAbsoluteTimeGetCurrent(void);
47 const CFTimeInterval kCFAbsoluteTimeIntervalSince1970
;
49 const CFTimeInterval kCFAbsoluteTimeIntervalSince1904
;
51 typedef const struct __CFDate
* CFDateRef
;
54 CFTypeID
CFDateGetTypeID(void);
57 CFDateRef
CFDateCreate(CFAllocatorRef allocator
, CFAbsoluteTime at
);
60 CFAbsoluteTime
CFDateGetAbsoluteTime(CFDateRef theDate
);
63 CFTimeInterval
CFDateGetTimeIntervalSinceDate(CFDateRef theDate
, CFDateRef otherDate
);
66 CFComparisonResult
CFDateCompare(CFDateRef theDate
, CFDateRef otherDate
, void *context
);
68 typedef const struct __CFTimeZone
* CFTimeZoneRef
;
89 kCFGregorianUnitsYears
= (1 << 0),
90 kCFGregorianUnitsMonths
= (1 << 1),
91 kCFGregorianUnitsDays
= (1 << 2),
92 kCFGregorianUnitsHours
= (1 << 3),
93 kCFGregorianUnitsMinutes
= (1 << 4),
94 kCFGregorianUnitsSeconds
= (1 << 5),
96 kCFGregorianUnitsTimeZone
= (1 << 8),
97 kCFGregorianUnitsDayOfWeek
= (1 << 9),
99 kCFGregorianAllUnits
= 0x00FFFFFF
100 } CFGregorianUnitFlags
;
103 Boolean
CFGregorianDateIsValid(CFGregorianDate gdate
, CFOptionFlags unitFlags
);
106 CFAbsoluteTime
CFGregorianDateGetAbsoluteTime(CFGregorianDate gdate
, CFTimeZoneRef tz
);
109 CFGregorianDate
CFAbsoluteTimeGetGregorianDate(CFAbsoluteTime at
, CFTimeZoneRef tz
);
112 CFAbsoluteTime
CFAbsoluteTimeAddGregorianUnits(CFAbsoluteTime at
, CFTimeZoneRef tz
, CFGregorianUnits units
);
115 CFGregorianUnits
CFAbsoluteTimeGetDifferenceAsGregorianUnits(CFAbsoluteTime at1
, CFAbsoluteTime at2
, CFTimeZoneRef tz
, CFOptionFlags unitFlags
);
118 SInt32
CFAbsoluteTimeGetDayOfWeek(CFAbsoluteTime at
, CFTimeZoneRef tz
);
121 SInt32
CFAbsoluteTimeGetDayOfYear(CFAbsoluteTime at
, CFTimeZoneRef tz
);
124 SInt32
CFAbsoluteTimeGetWeekOfYear(CFAbsoluteTime at
, CFTimeZoneRef tz
);
126 #if defined(__cplusplus)
130 #endif /* ! __COREFOUNDATION_CFDATE__ */