ObjFW
 All Classes Functions Variables
OFDate.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFObject.h"
18 #import "OFSerialization.h"
19 
20 @class OFString;
21 @class OFConstantString;
22 
27 {
28  double seconds;
29 }
30 
36 + (instancetype)date;
37 
45 + (instancetype)dateWithTimeIntervalSince1970: (double)seconds;
46 
53 + (instancetype)dateWithTimeIntervalSinceNow: (double)seconds;
54 
71 + (instancetype)dateWithDateString: (OFString*)string
72  format: (OFString*)format;
73 
87 + (instancetype)dateWithLocalDateString: (OFString*)string
88  format: (OFString*)format;
89 
97 + (instancetype)distantFuture;
98 
106 + (instancetype)distantPast;
107 
115 - initWithTimeIntervalSince1970: (double)seconds;
116 
124 - initWithTimeIntervalSinceNow: (double)seconds;
125 
143 - initWithDateString: (OFString*)string
144  format: (OFString*)format;
145 
161 - initWithLocalDateString: (OFString*)string
162  format: (OFString*)format;
163 
169 - (uint32_t)microsecond;
170 
176 - (uint8_t)second;
177 
183 - (uint8_t)minute;
184 
190 - (uint8_t)hour;
191 
197 - (uint8_t)localHour;
198 
204 - (uint8_t)dayOfMonth;
205 
211 - (uint8_t)localDayOfMonth;
212 
218 - (uint8_t)monthOfYear;
219 
225 - (uint8_t)localMonthOfYear;
226 
232 - (uint16_t)year;
233 
239 - (uint16_t)localYear;
240 
246 - (uint8_t)dayOfWeek;
247 
253 - (uint8_t)localDayOfWeek;
254 
260 - (uint16_t)dayOfYear;
261 
267 - (uint16_t)localDayOfYear;
268 
277 - (OFString*)dateStringWithFormat: (OFConstantString*)format;
278 
287 - (OFString*)localDateStringWithFormat: (OFConstantString*)format;
288 
295 - (OFDate*)earlierDate: (OFDate*)otherDate;
296 
303 - (OFDate*)laterDate: (OFDate*)otherDate;
304 
310 - (double)timeIntervalSince1970;
311 
318 - (double)timeIntervalSinceDate: (OFDate*)otherDate;
319 
325 - (double)timeIntervalSinceNow;
326 
333 - (OFDate*)dateByAddingTimeInterval: (double)seconds;
334 @end