Rudiments: /home/dmuse/temp/rudiments/include/rudiments/datetime.h Source File

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 getWeekOfYear() const;
154
158 int32_t getYear() const;
159
163 int32_t getShortYear() const;
164
167 int32_t getCentury() const;
168
171 bool isDaylightSavingsTime() const;
172
174 const char *getTimeZoneString() const;
175
177 int32_t getTimeZoneOffset() const;
178
189 bool adjustTimeZone(const char *newtz);
190
201 bool adjustTimeZone(const char *newtz, bool ignoredst);
202
203
206 bool setSeconds(int32_t seconds);
207
211 bool setMicroseconds(int32_t microseconds);
212
215 bool setMinutes(int32_t minutes);
216
219 bool setHours(int32_t hours);
220
223 bool setDays(int32_t days);
224
227 bool setMonths(int32_t months);
228
231 bool setYears(int32_t years);
232
235 bool addSeconds(int32_t seconds);
236
239 bool addMicroseconds(int32_t microseconds);
240
243 bool addMinutes(int32_t minutes);
244
247 bool addHours(int32_t hours);
248
251 bool addDays(int32_t days);
252
255 bool addMonths(int32_t months);
256
259 bool addYears(int32_t years);
260
261
268 const char *getString();
269
282 const char *getString(bool microseconds);
283
284
291 const char *getSqlString();
292
305 const char *getSqlString(bool microseconds);
306
307
309 time_t getEpoch() const;
310
311
314 static const char * const *getTimeZoneAbbreviations();
315
320 static const int32_t *getTimeZoneOffsets();
321
328 static bool validDateTime(const char *string);
329
336 static char *getString(time_t seconds);
337
344 static char *getString(time_t seconds, time_t microseconds);
345
352 static char *getString(const void *tmstruct);
353
360 static time_t getEpoch(const char *datestring);
361
368 static time_t getEpoch(const void *tmstruct);
369
371 static bool parse(const char *datetime,
372 bool ddmm, bool yyyyddmm,
373 const char *datedelimiters,
374 int16_t *year, int16_t *month,
375 int16_t *day, int16_t *hour,
376 int16_t *minute, int16_t *second,
377 int32_t *microsecond, bool *isnegative);
378
380 static char *formatAs(const char *format,
381 int16_t year, int16_t month,
382 int16_t day, int16_t hour,
383 int16_t minute, int16_t second,
384 int32_t microsecond, bool isnegative);
385
396 static void setTimeMutex(threadmutex *mtx);
397
398 #include <rudiments/private/datetime.h>
399 };
400
401 #endif
datetime
Definition: datetime.h:12
datetime::getString
const char * getString(bool microseconds)
datetime::getTimeZoneString
const char * getTimeZoneString() const
datetime::getTimeZoneOffsets
static const int32_t * getTimeZoneOffsets()
datetime::getEpoch
time_t getEpoch() const
datetime::setMinutes
bool setMinutes(int32_t minutes)
datetime::isDaylightSavingsTime
bool isDaylightSavingsTime() const
datetime::addDays
bool addDays(int32_t days)
datetime::setSeconds
bool setSeconds(int32_t seconds)
datetime::validDateTime
static bool validDateTime(const char *string)
datetime::formatAs
static char * formatAs(const char *format, int16_t year, int16_t month, int16_t day, int16_t hour, int16_t minute, int16_t second, int32_t microsecond, bool isnegative)
datetime::setHours
bool setHours(int32_t hours)
datetime::addMonths
bool addMonths(int32_t months)
datetime::getCentury
int32_t getCentury() const
datetime::setHardwareDateAndTime
bool setHardwareDateAndTime(const char *hwtz)
datetime::datetime
datetime()
datetime::getSystemDateAndTime
bool getSystemDateAndTime()
datetime::getString
const char * getString()
datetime::getHour
int32_t getHour() const
datetime::setYears
bool setYears(int32_t years)
datetime::getMinutes
int32_t getMinutes() const
datetime::adjustTimeZone
bool adjustTimeZone(const char *newtz)
datetime::getDayOfYear
int32_t getDayOfYear() const
datetime::getTimeZoneAbbreviations
static const char *const * getTimeZoneAbbreviations()
datetime::parse
static bool parse(const char *datetime, bool ddmm, bool yyyyddmm, const char *datedelimiters, int16_t *year, int16_t *month, int16_t *day, int16_t *hour, int16_t *minute, int16_t *second, int32_t *microsecond, bool *isnegative)
datetime::initialize
bool initialize(const char *tmstring)
datetime::getMonthName
const char * getMonthName() const
datetime::getShortYear
int32_t getShortYear() const
datetime::initialize
bool initialize(time_t seconds, time_t microseconds)
datetime::getString
static char * getString(const void *tmstruct)
datetime::setTimeMutex
static void setTimeMutex(threadmutex *mtx)
datetime::addMicroseconds
bool addMicroseconds(int32_t microseconds)
datetime::getDayOfMonth
int32_t getDayOfMonth() const
datetime::initialize
bool initialize(time_t seconds)
datetime::adjustTimeZone
bool adjustTimeZone(const char *newtz, bool ignoredst)
datetime::setDays
bool setDays(int32_t days)
datetime::getSeconds
int32_t getSeconds() const
datetime::getMonthAbbreviation
const char * getMonthAbbreviation() const
datetime::getDayOfWeek
int32_t getDayOfWeek() const
datetime::addMinutes
bool addMinutes(int32_t minutes)
datetime::initialize
bool initialize(const void *tmstruct)
datetime::setMonths
bool setMonths(int32_t months)
datetime::getEpoch
static time_t getEpoch(const char *datestring)
datetime::getAdjustedHardwareDateAndTime
bool getAdjustedHardwareDateAndTime(const char *hwtz)
datetime::getSqlString
const char * getSqlString(bool microseconds)
datetime::~datetime
~datetime()
datetime::getMonth
int32_t getMonth() const
datetime::getYear
int32_t getYear() const
datetime::getString
static char * getString(time_t seconds)
datetime::setMicroseconds
bool setMicroseconds(int32_t microseconds)
datetime::getMicroseconds
int32_t getMicroseconds() const
datetime::getString
static char * getString(time_t seconds, time_t microseconds)
datetime::addSeconds
bool addSeconds(int32_t seconds)
datetime::setSystemDateAndTime
bool setSystemDateAndTime()
datetime::getTimeZoneOffset
int32_t getTimeZoneOffset() const
datetime::getEpoch
static time_t getEpoch(const void *tmstruct)
datetime::addYears
bool addYears(int32_t years)
datetime::getSqlString
const char * getSqlString()
datetime::addHours
bool addHours(int32_t hours)
datetime::getWeekOfYear
int32_t getWeekOfYear() const
datetime::getHardwareDateAndTime
bool getHardwareDateAndTime(const char *hwtz)
threadmutex
Definition: threadmutex.h:11