#include <MamaDateTime.h>
Name | |
---|---|
MamaDateTime() | |
MamaDateTime(const MamaDateTime & copy) | |
MamaDateTime(const char * str, const MamaTimeZone * tz =NULL) | |
~MamaDateTime() | |
MamaDateTime & | operator=(const MamaDateTime & rhs) |
bool | operator==(const MamaDateTime & rhs) const |
bool | operator!=(const MamaDateTime & rhs) const |
bool | operator<(const MamaDateTime & rhs) const |
bool | operator>(const MamaDateTime & rhs) const |
int | compare(const MamaDateTime & rhs) const |
bool | empty() const |
void | setEpochTime(mama_u32_t secondsSinceEpoch, mama_u32_t microseconds, mamaDateTimePrecision precision =MAMA_DATE_TIME_PREC_UNKNOWN) |
void | setEpochTimeF64(double secondsSinceEpoch) |
void | setEpochTimeMilliseconds(mama_u64_t millisecondsSinceEpoch) |
void | setEpochTimeMicroseconds(mama_u64_t microsecondsSinceEpoch) |
void | setWithHints(mama_u32_t secondsSinceEpoch, mama_u32_t microseconds, mamaDateTimePrecision precision =MAMA_DATE_TIME_PREC_UNKNOWN, mamaDateTimeHints hints =0) |
mamaDateTimePrecision | getPrecision() |
void | setPrecision(mamaDateTimePrecision precision) |
mamaDateTimeHints | getHints() |
void | setHints(mamaDateTimeHints hints) |
void | setFromString(const char * str, const MamaTimeZone * tz =NULL) |
void | setFromString(const char * str, mama_size_t strLen, const MamaTimeZone * tz =NULL) |
void | setToNow() |
void | setToMidnightToday(const MamaTimeZone * tz =NULL) |
void | setFromStructTimeSpec(struct timespec & inputTimeSpec) |
void | set(struct timeval inputTimeVal) |
void | set(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 =MAMA_DATE_TIME_PREC_UNKNOWN, const MamaTimeZone * tz =NULL) |
void | setTime(mama_u32_t hour, mama_u32_t minute, mama_u32_t second, mama_u32_t microsecond, mamaDateTimePrecision precision =MAMA_DATE_TIME_PREC_UNKNOWN, const MamaTimeZone * tz =NULL) |
void | setDate(mama_u32_t year, mama_u32_t month, mama_u32_t day) |
void | copyTime(const MamaDateTime & copy) |
void | copyDate(const MamaDateTime & copy) |
void | clear() |
void | clearTime() |
void | clearDate() |
void | addSeconds(mama_f64_t seconds) |
void | addSeconds(mama_i32_t seconds) |
void | addMicroseconds(mama_i64_t microSeconds) |
mama_u64_t | getEpochTimeMicroseconds() const |
mama_u64_t | getEpochTimeMicroseconds(const MamaTimeZone & tz) const |
mama_u64_t | getEpochTimeMilliseconds() const |
mama_u64_t | getEpochTimeMilliseconds(const MamaTimeZone & tz) const |
mama_f64_t | getEpochTimeSeconds() const |
mama_f64_t | getEpochTimeSeconds(const MamaTimeZone & tz) const |
mama_i64_t | getEpochTimeExtSeconds() const |
uint32_t | getEpochTimeExtNanoseconds() const |
void | setEpochTimeExt(mama_i64_t seconds, uint32_t nanoseconds) const |
mama_f64_t | getEpochTimeSecondsWithCheck() const |
void | getAsString(char * result, mama_size_t maxLen) const |
void | getTimeAsString(char * result, mama_size_t maxLen) const |
void | getDateAsString(char * result, mama_size_t maxLen) const |
const char * | getAsString() const |
const char * | getTimeAsString() const |
const char * | getDateAsString() const |
void | getAsFormattedString(char * result, mama_size_t maxLen, const char * format) const |
void | getAsFormattedString(char * result, mama_size_t maxLen, const char * format, const MamaTimeZone & tz) const |
void | getAsStructTimeVal(struct timeval & result) const |
void | getAsStructTimeVal(struct timeval & result, const MamaTimeZone & tz) const |
void | getAsStructTimeSpec(struct timespec & result) const |
void | getAsStructTm(struct tm & result) const |
void | getAsStructTm(struct tm & result, const MamaTimeZone & tz) const |
mama_u32_t | getYear() const |
mama_u32_t | getMonth() const |
mama_u32_t | getDay() const |
mama_u32_t | getHour() const |
mama_u32_t | getMinute() const |
mama_u32_t | getSecond() const |
mama_u32_t | getMicrosecond() const |
mamaDayOfWeek | getDayOfWeek() const |
bool | hasTime() const |
bool | hasDate() const |
mamaDateTime | getCValue() |
const mamaDateTime | getCValue() const |
class Wombat::MamaDateTime;
A date/time representation with additional hints for precision, advanced output formatting and support for time zone conversion (using the MamaTimeZone type).
Hints include:
Actual Time | Output of “%T%;” | Output of “%T%.:” |
---|---|---|
01:23:45 and 678 millisecs | 01:23:45.678 | 01:23:45.678 |
01:23:45 and 0 millisecs | 01:23:45 | 01:23:45.000 |
MamaDateTime()
MamaDateTime(
const MamaDateTime & copy
)
explicit MamaDateTime(
const char * str,
const MamaTimeZone * tz =NULL
)
Constructor taking a string argument. This is the same as calling setFromString() immediately after construction.
~MamaDateTime()
MamaDateTime & operator=(
const MamaDateTime & rhs
)
bool operator==(
const MamaDateTime & rhs
) const
inline bool operator!=(
const MamaDateTime & rhs
) const
bool operator<(
const MamaDateTime & rhs
) const
bool operator>(
const MamaDateTime & rhs
) const
int compare(
const MamaDateTime & rhs
) const
bool empty() const
void setEpochTime(
mama_u32_t secondsSinceEpoch,
mama_u32_t microseconds,
mamaDateTimePrecision precision =MAMA_DATE_TIME_PREC_UNKNOWN
)
void setEpochTimeF64(
double secondsSinceEpoch
)
void setEpochTimeMilliseconds(
mama_u64_t millisecondsSinceEpoch
)
void setEpochTimeMicroseconds(
mama_u64_t microsecondsSinceEpoch
)
void setWithHints(
mama_u32_t secondsSinceEpoch,
mama_u32_t microseconds,
mamaDateTimePrecision precision =MAMA_DATE_TIME_PREC_UNKNOWN,
mamaDateTimeHints hints =0
)
mamaDateTimePrecision getPrecision()
void setPrecision(
mamaDateTimePrecision precision
)
mamaDateTimeHints getHints()
void setHints(
mamaDateTimeHints hints
)
void setFromString(
const char * str,
const MamaTimeZone * tz =NULL
)
void setFromString(
const char * str,
mama_size_t strLen,
const MamaTimeZone * tz =NULL
)
void setToNow()
void setToMidnightToday(
const MamaTimeZone * tz =NULL
)
void setFromStructTimeSpec(
struct timespec & inputTimeSpec
)
Set the underlying C mamaDateTime from a TimeSpec Struct. This will allow for extended date ranges.
void set(
struct timeval inputTimeVal
)
Set the underlying C mamaDateTime from a TimeVal Struct. This will allow for extended date ranges.
void set(
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 =MAMA_DATE_TIME_PREC_UNKNOWN,
const MamaTimeZone * tz =NULL
)
Parameters:
Set the entire date and time for the MamaDateTime. The year, month and day parameters must all be integers greater than zero.
void setTime(
mama_u32_t hour,
mama_u32_t minute,
mama_u32_t second,
mama_u32_t microsecond,
mamaDateTimePrecision precision =MAMA_DATE_TIME_PREC_UNKNOWN,
const MamaTimeZone * tz =NULL
)
Parameters:
Set the time-of-day portion of the MamaDateTime. The date portion is not affected.
void setDate(
mama_u32_t year,
mama_u32_t month,
mama_u32_t day
)
Parameters:
Set the date portion of the MamaDateTime. The time-of-day portion is not affected. The year, month and day parameters must all be integers greater than zero.
void copyTime(
const MamaDateTime & copy
)
Parameters:
Copy the time-of-day portion of the MamaDateTime. The date portion is not affected.
void copyDate(
const MamaDateTime & copy
)
Parameters:
Copy the date portion of the MamaDateTime. The time-of-day portion is not affected.
void clear()
Clear the entire MamaDateTime.
void clearTime()
Clear the time-of-day portion of the MamaDateTime. The date portion is not affected.
void clearDate()
Clear the date portion of the MamaDateTime. The time-of-day portion is not affected.
void addSeconds(
mama_f64_t seconds
)
void addSeconds(
mama_i32_t seconds
)
void addMicroseconds(
mama_i64_t microSeconds
)
mama_u64_t getEpochTimeMicroseconds() const
Return: The number of microseconds since the Epoch.
Get the date and time as microseconds since the Epoch, (using the UTC timezone).
mama_u64_t getEpochTimeMicroseconds(
const MamaTimeZone & tz
) const
Parameters:
Return: The number of microseconds since the Epoch.
Get the date and time as microseconds since the Epoch in the supplied time zone.
mama_u64_t getEpochTimeMilliseconds() const
mama_u64_t getEpochTimeMilliseconds(
const MamaTimeZone & tz
) const
mama_f64_t getEpochTimeSeconds() const
mama_f64_t getEpochTimeSeconds(
const MamaTimeZone & tz
) const
mama_i64_t getEpochTimeExtSeconds() const
Return: The number of whole seconds since the Epoch.
Get the extended datetime value in whole seconds since the Epoch (UTC).
uint32_t getEpochTimeExtNanoseconds() const
Return: The nanosecond portion of the datetime value.
Get the extended datetime subsecond portion of the datetime value in nanoseconds.
void setEpochTimeExt(
mama_i64_t seconds,
uint32_t nanoseconds
) const
Parameters:
Set the extended datetime values expressed in seconds since the Epoch (UTC) and nanoseconds since this epoch time.
mama_f64_t getEpochTimeSecondsWithCheck() const
Return: The number of seconds, (including partial seconds), since the Epoch.
Get the date and time as seconds since the Epoch, (using the UTC timezone). If no date value is contained in the dateTime then it will be set to today’s date and the calculation made.
void getAsString(
char * result,
mama_size_t maxLen
) const
void getTimeAsString(
char * result,
mama_size_t maxLen
) const
void getDateAsString(
char * result,
mama_size_t maxLen
) const
const char * getAsString() const
Return a string representation of the date/time. Note that the alternative getAsString() methods are more efficient because these method must allocate a temporary buffer (automatically destroyed upon object destruction). The timezone must to set to UTC if calling this from multiple threads concurrently to avoid contention in strftime.p
const char * getTimeAsString() const
const char * getDateAsString() const
void getAsFormattedString(
char * result,
mama_size_t maxLen,
const char * format
) const
void getAsFormattedString(
char * result,
mama_size_t maxLen,
const char * format,
const MamaTimeZone & tz
) const
void getAsStructTimeVal(
struct timeval & result
) const
void getAsStructTimeVal(
struct timeval & result,
const MamaTimeZone & tz
) const
void getAsStructTimeSpec(
struct timespec & result
) const
void getAsStructTm(
struct tm & result
) const
void getAsStructTm(
struct tm & result,
const MamaTimeZone & tz
) const
mama_u32_t getYear() const
mama_u32_t getMonth() const
mama_u32_t getDay() const
mama_u32_t getHour() const
mama_u32_t getMinute() const
mama_u32_t getSecond() const
mama_u32_t getMicrosecond() const
mamaDayOfWeek getDayOfWeek() const
bool hasTime() const
Return whether the object has a time component.
bool hasDate() const
Return whether the object has a date component.
mamaDateTime getCValue()
const mamaDateTime getCValue() const
Updated on 2023-03-31 at 15:29:25 +0100