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
12class RUDIMENTS_DLLSPEC datetime : public object {
13 public:
14
17
21
25
28
39 bool init(const char *tmstring);
40
46 bool init(time_t seconds);
47
54 bool init(time_t seconds, time_t microseconds);
55
65 bool init(const void *tmstruct);
66
72
83 bool initFromHardwareDateTime(const char *hwtz);
84
93 bool initFromAdjustedHardwareDateTime(const char *hwtz);
94
95
101
112 bool setHardwareDateTime(const char *hwtz);
113
114
120 bool setMicrosecond(int32_t microsecond);
121
126 bool setSecond(int32_t second);
127
132 bool setMinute(int32_t minute);
133
138 bool setHour(int32_t hour);
139
144 bool setDayOfMonth(int32_t day);
145
150 bool setMonth(int32_t month);
151
154 bool setYear(int32_t year);
155
169 bool setTimeZone(const char *newtz);
170
184 bool setTimeZone(const char *newtz, bool ignoredst);
185
186
189 bool addSeconds(int32_t seconds);
190
193 bool addMicroseconds(int32_t microseconds);
194
197 bool addMinutes(int32_t minutes);
198
201 bool addHours(int32_t hours);
202
205 bool addDays(int32_t days);
206
209 bool addMonths(int32_t months);
210
213 bool addYears(int32_t years);
214
215
218 int32_t getHour();
219
222 int32_t getMinute();
223
226 int32_t getSecond();
227
230 int32_t getMicrosecond();
231
234 int32_t getMonth();
235
238 const char *getMonthName();
239
242 const char *getMonthAbbreviation();
243
246 int32_t getDayOfMonth();
247
250 int32_t getDayOfWeek();
251
254 int32_t getDayOfYear();
255
262 int32_t getWeekOfYear();
263
266 int32_t getYear();
267
270 int32_t getShortYear();
271
274 int32_t getCentury();
275
279
281 const char *getTimeZoneString();
282
285
286
293 const char *getString();
294
307 const char *getString(bool microseconds);
308
309
316 const char *getSqlString();
317
330 const char *getSqlString(bool microseconds);
331
332
334 time_t getEpoch();
335
336
339 static const char * const *getTimeZoneAbbreviations();
340
345 static const int32_t *getTimeZoneOffsets();
346
353 static bool isValidDateTime(const char *string);
354
361 static char *getString(time_t seconds);
362
369 static char *getString(time_t seconds, time_t microseconds);
370
377 static char *getString(const void *tmstruct);
378
385 static time_t getEpoch(const char *datestring);
386
393 static time_t getEpoch(const void *tmstruct);
394
433 static bool parse(const char *datetime,
434 bool ddmm, bool yyyyddmm,
435 const char *datedelimiters,
436 int16_t *year, int16_t *month,
437 int16_t *day, int16_t *hour,
438 int16_t *minute, int16_t *second,
439 int32_t *microsecond, bool *isnegative);
440
473 static char *formatAs(const char *format,
474 int16_t year, int16_t month,
475 int16_t day, int16_t hour,
476 int16_t minute, int16_t second,
477 int32_t microsecond, bool isnegative);
478
489 static void setMutex(threadmutex *mtx);
490
491 #include <rudiments/private/datetime.h>
492};
493
494#endif
Definition datetime.h:12
int32_t getCentury()
int32_t getYear()
bool addDays(int32_t days)
int32_t getWeekOfYear()
bool addMonths(int32_t months)
static const char *const * getTimeZoneAbbreviations()
int32_t getSecond()
static void setMutex(threadmutex *mtx)
bool initFromSystemDateTime()
bool init(time_t seconds)
const char * getMonthName()
bool init(const char *tmstring)
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)
static char * getString(time_t seconds)
time_t getEpoch()
datetime(datetime &d)
bool setSecond(int32_t second)
int32_t getMonth()
bool setTimeZone(const char *newtz)
int32_t getHour()
const char * getSqlString(bool microseconds)
int32_t getMinute()
bool addMicroseconds(int32_t microseconds)
static const int32_t * getTimeZoneOffsets()
bool setYear(int32_t year)
static char * getString(const void *tmstruct)
int32_t getDayOfYear()
bool init(const void *tmstruct)
const char * getString(bool microseconds)
int32_t getDayOfWeek()
bool init(time_t seconds, time_t microseconds)
const char * getSqlString()
bool setHardwareDateTime(const char *hwtz)
bool setSystemDateTime()
bool addMinutes(int32_t minutes)
int32_t getMicrosecond()
static time_t getEpoch(const char *datestring)
bool initFromHardwareDateTime(const char *hwtz)
bool setTimeZone(const char *newtz, bool ignoredst)
bool setDayOfMonth(int32_t day)
int32_t getDayOfMonth()
datetime & operator=(datetime &d)
static bool isValidDateTime(const char *string)
bool setMicrosecond(int32_t microsecond)
bool isDaylightSavingsTime()
bool setHour(int32_t hour)
int32_t getTimeZoneOffset()
const char * getTimeZoneString()
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)
const char * getString()
bool initFromAdjustedHardwareDateTime(const char *hwtz)
bool setMinute(int32_t minute)
int32_t getShortYear()
bool addSeconds(int32_t seconds)
const char * getMonthAbbreviation()
static time_t getEpoch(const void *tmstruct)
bool addYears(int32_t years)
bool setMonth(int32_t month)
static char * getString(time_t seconds, time_t microseconds)
bool addHours(int32_t hours)
Definition object.h:10
Definition threadmutex.h:11