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 
18  datetime();
19 
21  ~datetime();
22 
31  bool initialize(const char *tmstring);
32 
38  bool initialize(time_t seconds);
39 
45  bool initialize(time_t seconds, time_t microseconds);
46 
58  bool initialize(const void *tmstruct);
59 
60 
65  bool getSystemDateAndTime();
66 
77  bool getHardwareDateAndTime(const char *hwtz);
78 
86  bool getAdjustedHardwareDateAndTime(const char *hwtz);
87 
92  bool setSystemDateAndTime();
93 
104  bool setHardwareDateAndTime(const char *hwtz);
105 
106 
109  int32_t getHour() const;
110 
113  int32_t getMinutes() const;
114 
117  int32_t getSeconds() const;
118 
121  int32_t getMicroseconds() const;
122 
125  int32_t getMonth() const;
126 
130  const char *getMonthName() const;
131 
135  const char *getMonthAbbreviation() const;
136 
140  int32_t getDayOfMonth() const;
141 
145  int32_t getDayOfWeek() const;
146 
150  int32_t getDayOfYear() const;
151 
155  int32_t getYear() const;
156 
159  bool isDaylightSavingsTime() const;
160 
162  const char *getTimeZoneString() const;
163 
165  int32_t getTimeZoneOffset() const;
166 
177  bool adjustTimeZone(const char *newtz);
178 
189  bool adjustTimeZone(const char *newtz, bool ignoredst);
190 
191 
194  bool setSeconds(int32_t seconds);
195 
199  bool setMicroseconds(int32_t microseconds);
200 
203  bool setMinutes(int32_t minutes);
204 
207  bool setHours(int32_t hours);
208 
211  bool setDays(int32_t days);
212 
215  bool setMonths(int32_t months);
216 
219  bool setYears(int32_t years);
220 
223  bool addSeconds(int32_t seconds);
224 
227  bool addMicroseconds(int32_t microseconds);
228 
231  bool addMinutes(int32_t minutes);
232 
235  bool addHours(int32_t hours);
236 
239  bool addDays(int32_t days);
240 
243  bool addMonths(int32_t months);
244 
247  bool addYears(int32_t years);
248 
249 
256  const char *getString();
257 
270  const char *getString(bool microseconds);
271 
273  time_t getEpoch() const;
274 
275 
278  static const char * const *getTimeZoneAbbreviations();
279 
284  static const int32_t *getTimeZoneOffsets();
285 
292  static bool validDateTime(const char *string);
293 
300  static char *getString(time_t seconds);
301 
308  static char *getString(time_t seconds, time_t microseconds);
309 
316  static char *getString(const void *tmstruct);
317 
324  static time_t getEpoch(const char *datestring);
325 
332  static time_t getEpoch(const void *tmstruct);
333 
334 
345  static void setTimeMutex(threadmutex *mtx);
346 
347  #include <rudiments/private/datetime.h>
348 };
349 
350 #endif
Definition: threadmutex.h:13
Definition: datetime.h:14