22 #ifndef MamaDateTimeH__
23 #define MamaDateTimeH__
29 #include "wombat/port.h"
34 #if defined(__cplusplus)
58 #define MAMA_DATE_TIME_HAS_DATE ((mamaDateTimeHints) 0x01)
59 #define MAMA_DATE_TIME_HAS_TIME ((mamaDateTimeHints) 0x02)
60 #define MAMA_DATE_TIME_NO_TIMEZONE ((mamaDateTimeHints) 0x04)
212 mamaDateTimeHints hints);
648 struct timeval* result);
660 struct timeval* result,
906 #if defined(__cplusplus)
int8_t mama_bool_t
Definition: types.h:42
enum mamaDayOfWeek_ mamaDayOfWeek
MAMAExpDLL mama_status mamaDateTime_getEpochTimeMicrosecondsWithTz(const mamaDateTime dateTime, mama_u64_t *microseconds, const mamaTimeZone tz)
Get the date and time as microseconds since the Epoch in the supplied time zone.
MAMAExpDLL mama_status mamaDateTime_setToNow(mamaDateTime dateTime)
Set the date and time to the current UTC time.
MAMAExpDLL mama_status mamaDateTime_setTimeWithPrecisionAndTz(mamaDateTime dateTime, mama_u32_t hour, mama_u32_t minute, mama_u32_t second, mama_u32_t microsecond, mamaDateTimePrecision precision, const mamaTimeZone tz)
Set the time-of-day portion of the MamaDateTime with explicit precision.
MAMAExpDLL mama_status mamaDateTime_getStructTmWithTz(const mamaDateTime dateTime, struct tm *result, const mamaTimeZone tz)
Get the date/time as a "struct tm" in the timezone supplied.
MAMAExpDLL mama_status mamaDateTime_destroy(mamaDateTime dateTime)
Destroy a mamaDateTime object.
MAMAExpDLL mama_status mamaDateTime_getMonth(const mamaDateTime dateTime, mama_u32_t *result)
Get the month (1-12).
MAMAExpDLL mama_status mamaDateTime_getMicrosecond(const mamaDateTime dateTime, mama_u32_t *result)
Get the microsecond (0-999999).
MAMAExpDLL mama_status mamaDateTime_hasDate(const mamaDateTime dateTime, mama_bool_t *result)
Determine whether the date portion of the MamaDateTime is set.
MAMAExpDLL mama_status mamaDateTime_addSeconds(mamaDateTime dateTime, mama_f64_t seconds)
Add a number of seconds, including fractional seconds (may be negative).
Definition: datetime.h:53
MAMAExpDLL mama_status mamaDateTime_setFromStringBufferWithTz(mamaDateTime dateTime, const char *str, mama_size_t strLen, const mamaTimeZone tz)
Set the date and time from an unterminated string representation of format YYYY-mm-dd HH:MM:SS...
MAMAExpDLL mama_status mamaDateTime_hasTime(const mamaDateTime dateTime, mama_bool_t *result)
Determine whether the time-of-day portion of the MamaDateTime is set.
uint8_t mama_u8_t
Definition: types.h:35
Definition: datetime.h:47
mama_u64_t * mamaDateTime
Flexible date/time format.
Definition: types.h:79
MAMAExpDLL mama_status mamaDateTime_getDay(const mamaDateTime dateTime, mama_u32_t *result)
Get the day of month (1-31).
MAMAExpDLL mama_status mamaDateTime_getTimeAsString(const mamaDateTime dateTime, char *str, mama_size_t maxLen)
Get the time (no date) as a string.
Definition: datetime.h:41
MAMAExpDLL int mamaDateTime_equal(const mamaDateTime lhs, const mamaDateTime rhs)
MAMAExpDLL mama_status mamaDateTime_getSecond(const mamaDateTime dateTime, mama_u32_t *result)
Get the second (0-59).
MAMAExpDLL mama_status mamaDateTime_getEpochTimeSecondsWithTz(const mamaDateTime dateTime, mama_f64_t *seconds, const mamaTimeZone tz)
Get the date and time as seconds since the Epoch in the timezone supplied.
uint64_t mama_u64_t
Definition: types.h:41
MAMAExpDLL mama_status mamaDateTime_addWholeSeconds(mamaDateTime dateTime, mama_i32_t seconds)
Add a number of whole seconds (may be negative).
MAMAExpDLL mama_status mamaDateTime_getMinute(const mamaDateTime dateTime, mama_u32_t *result)
Get the minute (0-59).
MAMAExpDLL mama_status mamaDateTime_getStructTm(const mamaDateTime dateTime, struct tm *result)
Get the date/time as a "struct tm".
MAMAExpDLL mama_status mamaDateTime_getDayOfWeek(const mamaDateTime dateTime, mamaDayOfWeek *result)
Get the day of week.
MAMAExpDLL mama_status mamaDateTime_copyTime(mamaDateTime dest, const mamaDateTime src)
Copy the time-of-day portion of the mamaDateTime.
Definition: datetime.h:43
MAMAExpDLL mama_status mamaDateTime_getEpochTimeSecondsWithCheck(const mamaDateTime dateTime, mama_f64_t *seconds)
Get the date and time as seconds since the Epoch, (using the UTC timezone).
MAMAExpDLL mama_status mamaDateTime_setPrecision(mamaDateTime dateTime, mamaDateTimePrecision precision)
Set the precision hint.
MAMAExpDLL mama_status mamaDateTime_setToMidnightToday(mamaDateTime dateTime, const mamaTimeZone tz)
Set the dateTime object to 12am of the current date in the timezone provided (or UTC if NULL)...
MAMAExpDLL mama_status mamaDateTime_getEpochTime(const mamaDateTime dateTime, mama_u32_t *seconds, mama_u32_t *microseconds, mamaDateTimePrecision *precision)
Get the date and time as seconds and microseconds since the Epoch (UTC time zone).
MAMAExpDLL mama_status mamaDateTime_setEpochTime(mamaDateTime dateTime, mama_u32_t seconds, mama_u32_t microseconds, mamaDateTimePrecision precision)
Set the date and time as seconds and microseconds since the Epoch (UTC time zone) with an option to d...
Definition: datetime.h:53
void * mamaTimeZone
Time zone utility type.
Definition: types.h:84
mama_u8_t mamaDateTimeHints
Definition: datetime.h:57
mamaDateTimePrecision_
Definition: datetime.h:39
MAMAExpDLL mama_status mamaDateTime_setFromString(mamaDateTime dateTime, const char *str)
Set the date and time from a string representation of format YYYY-mm-dd HH:MM:SS.mmmmmm.
MAMAExpDLL mama_status mamaDateTime_getStructTimeValWithTz(const mamaDateTime dateTime, struct timeval *result, const mamaTimeZone tz)
Get the date/time as a "struct timeval" in the timezone supplied.
Definition: datetime.h:45
MAMAExpDLL mama_status mamaDateTime_setEpochTimeF64(mamaDateTime dateTime, mama_f64_t seconds)
Set the date and time as seconds (plus, possibly fractional seconds) since the Epoch (UTC time zone)...
enum mamaDateTimePrecision_ mamaDateTimePrecision
const char * format
Definition: log.h:59
MAMAExpDLL mama_status mamaDateTime_getEpochTimeMillisecondsWithTz(const mamaDateTime dateTime, mama_u64_t *milliseconds, const mamaTimeZone tz)
Get the date and time as milliseconds since the Epoch in the timezone supplied.
MAMAExpDLL mama_status mamaDateTime_clearDate(mamaDateTime dateTime)
Clear the date part of a mamaDateTime object.
MAMAExpDLL mama_status mamaDateTime_diffSecondsSameDay(const mamaDateTime t1, const mamaDateTime t0, mama_f64_t *result)
Return the difference, in seconds (including fractions of seconds), between the two times...
MAMAExpDLL mama_status mamaDateTime_getAsFormattedStringWithTz(const mamaDateTime dateTime, char *str, mama_size_t maxLen, const char *format, const mamaTimeZone tz)
Get the date and/or time as a string using the format provided.
MAMAExpDLL mama_status mamaDateTime_getStructTimeVal(const mamaDateTime dateTime, struct timeval *result)
Get the date/time as a "struct timeval".
MAMAExpDLL int mamaDateTime_compare(const mamaDateTime lhs, const mamaDateTime rhs)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeMicroseconds(const mamaDateTime dateTime, mama_u64_t *microseconds)
Get the date and time as microseconds since the Epoch, (using the UTC timezone).
Definition: datetime.h:42
MAMAExpDLL mama_status mamaDateTime_getAsFormattedString(const mamaDateTime dateTime, char *str, mama_size_t maxLen, const char *format)
Get the date and/or time as a string using the format provided.
MAMAExpDLL mama_status mamaDateTime_setEpochTimeMicroseconds(mamaDateTime dateTime, mama_u64_t milliseconds)
Set the date and time as microseconds.
MAMAExpDLL mama_status mamaDateTime_clearTime(mamaDateTime dateTime)
Clear the time of day part of a mamaDateTime object (preserving the date).
double mama_f64_t
Definition: types.h:44
Definition: datetime.h:44
int64_t mama_i64_t
Definition: types.h:40
MAMAExpDLL mama_status mamaDateTime_getEpochTimeMilliseconds(const mamaDateTime dateTime, mama_u64_t *milliseconds)
Get the date and time as milliseconds since the Epoch (UTC time zone).
MAMAExpDLL mama_status mamaDateTime_create(mamaDateTime *dateTime)
Create a date/time object.
MAMAExpDLL mama_status mamaDateTime_getDateAsString(const mamaDateTime dateTime, char *str, mama_size_t maxLen)
Get the date (no time) as a string.
MAMAExpDLL mama_status mamaDateTime_getEpochTimeWithTz(const mamaDateTime dateTime, mama_u32_t *seconds, mama_u32_t *microseconds, mamaDateTimePrecision *precision, const mamaTimeZone tz)
Get the date and time as seconds and microseconds since the Epoch in the timezone supplied...
MAMAExpDLL mama_status mamaDateTime_setWithHints(mamaDateTime dateTime, mama_u32_t seconds, mama_u32_t microseconds, mamaDateTimePrecision precision, mamaDateTimeHints hints)
Set the date and/or time with special, optional hints to indicate whether the date/time includes date...
mama_status
Definition: status.h:37
MAMAExpDLL mama_status mamaDateTime_diffMicroseconds(const mamaDateTime t1, const mamaDateTime t0, mama_i64_t *result)
Return the difference, in microseconds, between the two times.
MAMAExpDLL mama_status mamaDateTime_copyDate(mamaDateTime dest, const mamaDateTime src)
Copy the date portion of the mamaDateTime.
MAMAExpDLL mama_status mamaDateTime_addMicroseconds(mamaDateTime dateTime, mama_i64_t microseconds)
Add a number of microseconds (may be negative) Add a number of microseconds (may be negative and grea...
uint32_t mama_u32_t
Definition: types.h:39
size_t mama_size_t
Definition: types.h:47
Definition: datetime.h:48
MAMAExpDLL mama_status mamaDateTime_getHour(const mamaDateTime dateTime, mama_u32_t *result)
Get the hour (0-23).
MAMAExpDLL mama_status mamaDateTime_getEpochTimeSeconds(const mamaDateTime dateTime, mama_f64_t *seconds)
Get the date and time as seconds since the Epoch (UTC time zone).
Definition: datetime.h:53
MAMAExpDLL mama_status mamaDateTime_setEpochTimeMilliseconds(mamaDateTime dateTime, mama_u64_t milliseconds)
Set the date and time as milliseconds.
MAMAExpDLL mama_status mamaDateTime_diffSeconds(const mamaDateTime t1, const mamaDateTime t0, mama_f64_t *result)
Return the difference, in seconds (including fractions of seconds), between the two times...
MAMAExpDLL mama_status mamaDateTime_setDate(mamaDateTime dateTime, mama_u32_t year, mama_u32_t month, mama_u32_t day)
Set the date portion of the MamaDateTime.
MAMAExpDLL mama_status mamaDateTime_setTime(mamaDateTime dateTime, mama_u32_t hour, mama_u32_t minute, mama_u32_t second, mama_u32_t microsecond)
Set the time-of-day portion of the MamaDateTime.
MAMAExpDLL mama_status mamaDateTime_getAsString(const mamaDateTime dateTime, char *str, mama_size_t maxLen)
Get the date and/or time as a string.
MAMAExpDLL int mamaDateTime_empty(const mamaDateTime dateTime)
MAMAExpDLL mama_status mamaDateTime_setWithPrecisionAndTz(mamaDateTime dateTime, mama_u32_t year, mama_u32_t month, mama_u32_t day, mama_u32_t hour, mama_u32_t minute, mama_u32_t second, mama_u32_t microsecond, mamaDateTimePrecision precision, const mamaTimeZone tz)
Set the entire date and time for the MamaDateTime.
MAMAExpDLL mama_status mamaDateTime_clear(mamaDateTime dateTime)
Clear a mamaDateTime object.
int32_t mama_i32_t
Definition: types.h:38
Definition: datetime.h:53
Definition: datetime.h:53
mamaDayOfWeek_
Definition: datetime.h:51
MAMAExpDLL mama_status mamaDateTime_getWithHints(const mamaDateTime dateTime, mama_u32_t *seconds, mama_u32_t *microseconds, mamaDateTimePrecision *precision, mama_u8_t *hints)
Get the date and/or time with special, optional hints to indicate whether the date/time includes date...
MAMAExpDLL mama_status mamaDateTime_copy(mamaDateTime dest, const mamaDateTime src)
Definition: datetime.h:53
Definition: datetime.h:46
Definition: datetime.h:53
MAMAExpDLL mama_status mamaDateTime_setFromStringBuffer(mamaDateTime dateTime, const char *str, mama_size_t strLen)
Set the date and time from an unterminated string representation of format YYYY-mm-dd HH:MM:SS...
MAMAExpDLL mama_status mamaDateTime_setFromStringWithTz(mamaDateTime dateTime, const char *str, const mamaTimeZone tz)
Set the date and time from a string representation of format YYYY-mm-dd HH:MM:SS.mmmmmm.
MAMAExpDLL mama_status mamaDateTime_getYear(const mamaDateTime dateTime, mama_u32_t *result)
Get the year (1970 onwards).