Merge pull request #10 from gunyarakun/fix-invalid-return
[cocotron.git] / CoreFoundation / CFDate.h
blob08e4d00476df254f539d4b1108680c5d927b9d3e
1 /* Copyright (c) 2008-2009 Christopher J. W. Lloyd
3 Permission is hereby granted,free of charge,to any person obtaining a copy of this software and associated documentation files (the "Software"),to deal in the Software without restriction,including without limitation the rights to use,copy,modify,merge,publish,distribute,sublicense,and/or sell copies of the Software,and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
5 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
8 #import <CoreFoundation/CFBase.h>
10 typedef struct __NSDate *CFDateRef;
12 typedef double CFTimeInterval;
13 typedef CFTimeInterval CFAbsoluteTime;
15 #import <CoreFoundation/CFTimeZone.h>
17 typedef struct {
18 SInt32 year;
19 SInt8 month;
20 SInt8 day;
21 SInt8 hour;
22 SInt8 minute;
23 double second;
24 } CFGregorianDate;
26 typedef struct {
27 SInt32 years;
28 SInt32 months;
29 SInt32 days;
30 SInt32 hours;
31 SInt32 minutes;
32 double seconds;
33 } CFGregorianUnits;
35 typedef enum {
36 kCFGregorianUnitsYears = 0x01,
37 kCFGregorianUnitsMonths = 0x02,
38 kCFGregorianUnitsDays = 0x04,
39 kCFGregorianUnitsHours = 0x08,
40 kCFGregorianUnitsMinutes = 0x10,
41 kCFGregorianUnitsSeconds = 0x20,
42 kCFGregorianAllUnits = 0x00FFFFFF
43 } CFGregorianUnitFlags;
45 COREFOUNDATION_EXPORT const CFTimeInterval kCFAbsoluteTimeIntervalSince1970;
46 COREFOUNDATION_EXPORT const CFTimeInterval kCFAbsoluteTimeIntervalSince1904;
48 COREFOUNDATION_EXPORT CFTypeID CFDateGetTypeID(void);
50 COREFOUNDATION_EXPORT CFDateRef CFDateCreate(CFAllocatorRef allocator, CFAbsoluteTime absoluteTime);
52 COREFOUNDATION_EXPORT CFComparisonResult CFDateCompare(CFDateRef self, CFDateRef other, void *context);
53 COREFOUNDATION_EXPORT CFAbsoluteTime CFDateGetAbsoluteTime(CFDateRef self);
54 COREFOUNDATION_EXPORT CFTimeInterval CFDateGetTimeIntervalSinceDate(CFDateRef self, CFDateRef other);
56 COREFOUNDATION_EXPORT CFAbsoluteTime CFAbsoluteTimeGetCurrent();
58 COREFOUNDATION_EXPORT SInt32 CFAbsoluteTimeGetWeekOfYear(CFAbsoluteTime absoluteTime, CFTimeZoneRef timeZone);
59 COREFOUNDATION_EXPORT SInt32 CFAbsoluteTimeGetDayOfWeek(CFAbsoluteTime absoluteTime, CFTimeZoneRef timeZone);
60 COREFOUNDATION_EXPORT SInt32 CFAbsoluteTimeGetDayOfYear(CFAbsoluteTime absoluteTime, CFTimeZoneRef timeZone);
62 COREFOUNDATION_EXPORT CFAbsoluteTime CFAbsoluteTimeAddGregorianUnits(CFAbsoluteTime absoluteTime, CFTimeZoneRef timeZone, CFGregorianUnits units);
63 COREFOUNDATION_EXPORT CFGregorianUnits CFAbsoluteTimeGetDifferenceAsGregorianUnits(CFAbsoluteTime absoluteTime, CFAbsoluteTime other, CFTimeZoneRef timeZone, CFOptionFlags unitFlags);
64 COREFOUNDATION_EXPORT CFGregorianDate CFAbsoluteTimeGetGregorianDate(CFAbsoluteTime absoluteTime, CFTimeZoneRef timeZone);
66 COREFOUNDATION_EXPORT CFAbsoluteTime CFGregorianDateGetAbsoluteTime(CFGregorianDate gregorianDate, CFTimeZoneRef timeZone);
68 COREFOUNDATION_EXPORT Boolean CFGregorianDateIsValid(CFGregorianDate gregorianDate, CFOptionFlags unitFlags);