Rudiments
datetime.h
1 // Copyright (c) 1999-2018 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 
12 class RUDIMENTS_DLLSPEC datetime {
13  public:
14 
16  datetime();
17 
19  ~datetime();
20 
29  bool initialize(const char *tmstring);
30 
36  bool initialize(time_t seconds);
37 
43  bool initialize(time_t seconds, time_t microseconds);
44 
56  bool initialize(const void *tmstruct);
57 
58 
63  bool getSystemDateAndTime();
64 
75  bool getHardwareDateAndTime(const char *hwtz);
76 
84  bool getAdjustedHardwareDateAndTime(const char *hwtz);
85 
90  bool setSystemDateAndTime();
91 
102  bool setHardwareDateAndTime(const char *hwtz);
103 
104 
107  int32_t getHour() const;
108 
111  int32_t getMinutes() const;
112 
115  int32_t getSeconds() const;
116 
119  int32_t getMicroseconds() const;
120 
123  int32_t getMonth() const;
124 
128  const char *getMonthName() const;
129 
133  const char *getMonthAbbreviation() const;
134 
138  int32_t getDayOfMonth() const;
139 
143  int32_t getDayOfWeek() const;
144 
148  int32_t getDayOfYear() const;
149 
153  int32_t getYear() const;
154 
157  bool isDaylightSavingsTime() const;
158 
160  const char *getTimeZoneString() const;
161 
163  int32_t getTimeZoneOffset() const;
164 
175  bool adjustTimeZone(const char *newtz);
176 
187  bool adjustTimeZone(const char *newtz, bool ignoredst);
188 
189 
192  bool setSeconds(int32_t seconds);
193 
197  bool setMicroseconds(int32_t microseconds);
198 
201  bool setMinutes(int32_t minutes);
202 
205  bool setHours(int32_t hours);
206 
209  bool setDays(int32_t days);
210 
213  bool setMonths(int32_t months);
214 
217  bool setYears(int32_t years);
218 
221  bool addSeconds(int32_t seconds);
222 
225  bool addMicroseconds(int32_t microseconds);
226 
229  bool addMinutes(int32_t minutes);
230 
233  bool addHours(int32_t hours);
234 
237  bool addDays(int32_t days);
238 
241  bool addMonths(int32_t months);
242 
245  bool addYears(int32_t years);
246 
247 
254  const char *getString();
255 
268  const char *getString(bool microseconds);
269 
271  time_t getEpoch() const;
272 
273 
276  static const char * const *getTimeZoneAbbreviations();
277 
282  static const int32_t *getTimeZoneOffsets();
283 
290  static bool validDateTime(const char *string);
291 
298  static char *getString(time_t seconds);
299 
306  static char *getString(time_t seconds, time_t microseconds);
307 
314  static char *getString(const void *tmstruct);
315 
322  static time_t getEpoch(const char *datestring);
323 
330  static time_t getEpoch(const void *tmstruct);
331 
332 
343  static void setTimeMutex(threadmutex *mtx);
344 
345  #include <rudiments/private/datetime.h>
346 };
347 
348 #endif
Definition: threadmutex.h:11
Definition: datetime.h:12