Rudiments
datetime.h
1 // Copyright (c) 2000-2002 David Muse
2 // See the COPYING file for more information.
3 
4 #ifndef RUDIMENTS_DATETIME_H
5 #define RUDIMENTS_DATETIME_H
6 
7 #include <rudiments/private/datetimeincludes.h>
8 
9 class datetimeprivate;
10 
14 class RUDIMENTS_DLLSPEC datetime {
15  public:
16 
23  static char *getString(time_t seconds);
24 
31  static char *getString(time_t seconds, time_t microseconds);
32 
39  static char *getString(const void *tmstruct);
40 
47  static time_t getEpoch(const char *datestring);
48 
55  static time_t getEpoch(const void *tmstruct);
56 
57 
59  datetime();
60 
62  ~datetime();
63 
72  bool initialize(const char *tmstring);
73 
79  bool initialize(time_t seconds);
80 
86  bool initialize(time_t seconds, time_t microseconds);
87 
99  bool initialize(const void *tmstruct);
100 
101 
106  bool getSystemDateAndTime();
107 
118  bool getHardwareDateAndTime(const char *hwtz);
119 
127  bool getAdjustedHardwareDateAndTime(const char *hwtz);
128 
133  bool setSystemDateAndTime();
134 
145  bool setHardwareDateAndTime(const char *hwtz);
146 
147 
150  int32_t getHour() const;
151 
154  int32_t getMinutes() const;
155 
158  int32_t getSeconds() const;
159 
162  int32_t getMicroseconds() const;
163 
166  int32_t getMonth() const;
167 
171  const char *getMonthName() const;
172 
176  const char *getMonthAbbreviation() const;
177 
181  int32_t getDayOfMonth() const;
182 
186  int32_t getDayOfWeek() const;
187 
191  int32_t getDayOfYear() const;
192 
196  int32_t getYear() const;
197 
200  bool isDaylightSavingsTime() const;
201 
203  const char *getTimeZoneString() const;
204 
206  int32_t getTimeZoneOffset() const;
207 
218  bool adjustTimeZone(const char *newtz);
219 
230  bool adjustTimeZone(const char *newtz, bool ignoredst);
231 
232 
235  bool setSeconds(int32_t seconds);
236 
240  bool setMicroseconds(int32_t microseconds);
241 
244  bool setMinutes(int32_t minutes);
245 
248  bool setHours(int32_t hours);
249 
252  bool setDays(int32_t days);
253 
256  bool setMonths(int32_t months);
257 
260  bool setYears(int32_t years);
261 
264  bool addSeconds(int32_t seconds);
265 
268  bool addMicroseconds(int32_t microseconds);
269 
272  bool addMinutes(int32_t minutes);
273 
276  bool addHours(int32_t hours);
277 
280  bool addDays(int32_t days);
281 
284  bool addMonths(int32_t months);
285 
288  bool addYears(int32_t years);
289 
290 
297  const char *getString();
298 
311  const char *getString(bool microseconds);
312 
314  time_t getEpoch() const;
315 
316 
319  static const char * const *getTimeZoneAbbreviations();
320 
325  static const int32_t *getTimeZoneOffsets();
326 
333  static bool validDateTime(const char *string);
334 
335 
346  static void setTimeMutex(threadmutex *mtx);
347 
348  #include <rudiments/private/datetime.h>
349 };
350 
351 #endif
Definition: threadmutex.h:13
Definition: datetime.h:14