Classes Files

mama/datetime.h

Types

  Name
enum mamaDateTimePrecision_ { MAMA_DATE_TIME_PREC_SECONDS = 0, MAMA_DATE_TIME_PREC_DECISECONDS = 1, MAMA_DATE_TIME_PREC_CENTISECONDS = 2, MAMA_DATE_TIME_PREC_MILLISECONDS = 3, MAMA_DATE_TIME_PREC_MICROSECONDS = 6, MAMA_DATE_TIME_PREC_NANOSECONDS = 9, MAMA_DATE_TIME_PREC_DAYS = 10, MAMA_DATE_TIME_PREC_MINUTES = 12, MAMA_DATE_TIME_PREC_UNKNOWN = 15}
enum mamaDayOfWeek_ { Sunday = 0, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday}
typedef enum mamaDateTimePrecision_ mamaDateTimePrecision
typedef enum mamaDayOfWeek_ mamaDayOfWeek
typedef mama_u8_t mamaDateTimeHints

Functions

  Name
MAMAExpDLL mama_status mamaDateTime_create(mamaDateTime * dateTime)
MAMAExpDLL mama_status mamaDateTime_destroy(mamaDateTime dateTime)
MAMAExpDLL mama_status mamaDateTime_clear(mamaDateTime dateTime)
MAMAExpDLL mama_status mamaDateTime_clearDate(mamaDateTime dateTime)
MAMAExpDLL mama_status mamaDateTime_clearTime(mamaDateTime dateTime)
MAMAExpDLL mama_status mamaDateTime_copy(mamaDateTime dest, const mamaDateTime src)
MAMAExpDLL int mamaDateTime_empty(const mamaDateTime dateTime)
MAMAExpDLL int mamaDateTime_equal(const mamaDateTime lhs, const mamaDateTime rhs)
MAMAExpDLL int mamaDateTime_compare(const mamaDateTime lhs, const mamaDateTime rhs)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeExt(const mamaDateTime dateTime, mama_i64_t * seconds, mama_u32_t * nanoseconds)
MAMAExpDLL mama_status mamaDateTime_setEpochTimeExt(mamaDateTime dateTime, mama_i64_t seconds, mama_u32_t nanoseconds)
MAMAExpDLL mama_status mamaDateTime_setEpochTime(mamaDateTime dateTime, mama_u32_t seconds, mama_u32_t microseconds, mamaDateTimePrecision precision)
MAMAExpDLL mama_status mamaDateTime_setEpochTimeF64(mamaDateTime dateTime, mama_f64_t seconds)
MAMAExpDLL mama_status mamaDateTime_setEpochTimeMilliseconds(mamaDateTime dateTime, mama_u64_t milliseconds)
MAMAExpDLL mama_status mamaDateTime_setEpochTimeMicroseconds(mamaDateTime dateTime, mama_u64_t milliseconds)
MAMAExpDLL mama_status mamaDateTime_setWithHints(mamaDateTime dateTime, mama_u32_t seconds, mama_u32_t microseconds, mamaDateTimePrecision precision, mamaDateTimeHints hints)
MAMAExpDLL mama_status mamaDateTime_getHints(const mamaDateTime dateTime, mamaDateTimeHints * hints)
MAMAExpDLL mama_status mamaDateTime_setHints(mamaDateTime dateTime, mamaDateTimeHints hints)
MAMAExpDLL mama_status mamaDateTime_getPrecision(const mamaDateTime dateTime, mamaDateTimePrecision * precision)
MAMAExpDLL mama_status mamaDateTime_setPrecision(mamaDateTime dateTime, mamaDateTimePrecision precision)
MAMAExpDLL mama_status mamaDateTime_setToNow(mamaDateTime dateTime)
MAMAExpDLL mama_status mamaDateTime_setToMidnightToday(mamaDateTime dateTime, const mamaTimeZone tz)
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)
MAMAExpDLL mama_status mamaDateTime_setTime(mamaDateTime dateTime, mama_u32_t hour, mama_u32_t minute, mama_u32_t second, mama_u32_t microsecond)
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)
MAMAExpDLL mama_status mamaDateTime_setDate(mamaDateTime dateTime, mama_u32_t year, mama_u32_t month, mama_u32_t day)
MAMAExpDLL mama_status mamaDateTime_copyTime(mamaDateTime dest, const mamaDateTime src)
MAMAExpDLL mama_status mamaDateTime_copyDate(mamaDateTime dest, const mamaDateTime src)
MAMAExpDLL mama_status mamaDateTime_hasTime(const mamaDateTime dateTime, mama_bool_t * result)
MAMAExpDLL mama_status mamaDateTime_hasDate(const mamaDateTime dateTime, mama_bool_t * result)
MAMAExpDLL mama_status mamaDateTime_addSeconds(mamaDateTime dateTime, mama_f64_t seconds)
MAMAExpDLL mama_status mamaDateTime_addWholeSeconds(mamaDateTime dateTime, mama_i32_t seconds)
MAMAExpDLL mama_status mamaDateTime_addMicroseconds(mamaDateTime dateTime, mama_i64_t microseconds)
MAMAExpDLL mama_status mamaDateTime_setFromString(mamaDateTime dateTime, const char * str)
MAMAExpDLL mama_status mamaDateTime_setFromStringWithTz(mamaDateTime dateTime, const char * str, const mamaTimeZone tz)
MAMAExpDLL mama_status mamaDateTime_setFromStringBuffer(mamaDateTime dateTime, const char * str, mama_size_t strLen)
MAMAExpDLL mama_status mamaDateTime_setFromStringBufferWithTz(mamaDateTime dateTime, const char * str, mama_size_t strLen, const mamaTimeZone tz)
MAMAExpDLL mama_status mamaDateTime_getEpochTime(const mamaDateTime dateTime, mama_u32_t * seconds, mama_u32_t * microseconds, mamaDateTimePrecision * precision)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeWithTz(const mamaDateTime dateTime, mama_u32_t * seconds, mama_u32_t * microseconds, mamaDateTimePrecision * precision, const mamaTimeZone tz)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeMicroseconds(const mamaDateTime dateTime, mama_u64_t * microseconds)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeMicrosecondsWithTz(const mamaDateTime dateTime, mama_u64_t * microseconds, const mamaTimeZone tz)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeMilliseconds(const mamaDateTime dateTime, mama_u64_t * milliseconds)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeMillisecondsWithTz(const mamaDateTime dateTime, mama_u64_t * milliseconds, const mamaTimeZone tz)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeSeconds(const mamaDateTime dateTime, mama_f64_t * seconds)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeSecondsWithCheck(const mamaDateTime dateTime, mama_f64_t * seconds)
MAMAExpDLL mama_status mamaDateTime_getEpochTimeSecondsWithTz(const mamaDateTime dateTime, mama_f64_t * seconds, const mamaTimeZone tz)
MAMAExpDLL mama_status mamaDateTime_getWithHints(const mamaDateTime dateTime, mama_u32_t * seconds, mama_u32_t * microseconds, mamaDateTimePrecision * precision, mama_u8_t * hints)
MAMAExpDLL mama_status mamaDateTime_getStructTimeVal(const mamaDateTime dateTime, struct timeval * result)
MAMAExpDLL mama_status mamaDateTime_getStructTimeValWithTz(const mamaDateTime dateTime, struct timeval * result, const mamaTimeZone tz)
MAMAExpDLL mama_status mamaDateTime_setFromStructTimeVal(const mamaDateTime dateTime, struct timeval * inputTimeVal)
MAMAExpDLL mama_status mamaDateTime_getStructTm(const mamaDateTime dateTime, struct tm * result)
MAMAExpDLL mama_status mamaDateTime_getStructTmWithTz(const mamaDateTime dateTime, struct tm * result, const mamaTimeZone tz)
MAMAExpDLL mama_status mamaDateTime_getAsString(const mamaDateTime dateTime, char * str, mama_size_t maxLen)
MAMAExpDLL mama_status mamaDateTime_getTimeAsString(const mamaDateTime dateTime, char * str, mama_size_t maxLen)
MAMAExpDLL mama_status mamaDateTime_getDateAsString(const mamaDateTime dateTime, char * str, mama_size_t maxLen)
MAMAExpDLL mama_status mamaDateTime_getAsFormattedString(const mamaDateTime dateTime, char * str, mama_size_t maxLen, const char * format)
MAMAExpDLL mama_status mamaDateTime_getAsFormattedStringWithTz(const mamaDateTime dateTime, char * str, mama_size_t maxLen, const char * format, const mamaTimeZone tz)
MAMAExpDLL mama_status mamaDateTime_getYear(const mamaDateTime dateTime, mama_u32_t * result)
MAMAExpDLL mama_status mamaDateTime_getMonth(const mamaDateTime dateTime, mama_u32_t * result)
MAMAExpDLL mama_status mamaDateTime_getDay(const mamaDateTime dateTime, mama_u32_t * result)
MAMAExpDLL mama_status mamaDateTime_getHour(const mamaDateTime dateTime, mama_u32_t * result)
MAMAExpDLL mama_status mamaDateTime_getMinute(const mamaDateTime dateTime, mama_u32_t * result)
MAMAExpDLL mama_status mamaDateTime_getSecond(const mamaDateTime dateTime, mama_u32_t * result)
MAMAExpDLL mama_status mamaDateTime_getMicrosecond(const mamaDateTime dateTime, mama_u32_t * result)
MAMAExpDLL mama_status mamaDateTime_getDayOfWeek(const mamaDateTime dateTime, mamaDayOfWeek * result)
MAMAExpDLL mama_status mamaDateTime_diffSeconds(const mamaDateTime t1, const mamaDateTime t0, mama_f64_t * result)
MAMAExpDLL mama_status mamaDateTime_diffSecondsSameDay(const mamaDateTime t1, const mamaDateTime t0, mama_f64_t * result)
MAMAExpDLL mama_status mamaDateTime_diffMicroseconds(const mamaDateTime t1, const mamaDateTime t0, mama_i64_t * result)
MAMAExpDLL mama_status mamaDateTime_setFromStructTimeSpec(const mamaDateTime dateTime, struct timespec * inputTimeVal)
MAMAExpDLL mama_status mamaDateTime_getStructTimeSpec(const mamaDateTime dateTime, struct timespec * result)

Defines

  Name
  MAMA_DATE_TIME_HAS_DATE
  MAMA_DATE_TIME_HAS_TIME
  MAMA_DATE_TIME_NO_TIMEZONE

Types Documentation

enum mamaDateTimePrecision_

Enumerator Value Description
MAMA_DATE_TIME_PREC_SECONDS 0  
MAMA_DATE_TIME_PREC_DECISECONDS 1  
MAMA_DATE_TIME_PREC_CENTISECONDS 2  
MAMA_DATE_TIME_PREC_MILLISECONDS 3  
MAMA_DATE_TIME_PREC_MICROSECONDS 6  
MAMA_DATE_TIME_PREC_NANOSECONDS 9  
MAMA_DATE_TIME_PREC_DAYS 10  
MAMA_DATE_TIME_PREC_MINUTES 12  
MAMA_DATE_TIME_PREC_UNKNOWN 15  

enum mamaDayOfWeek_

Enumerator Value Description
Sunday 0  
Monday    
Tuesday    
Wednesday    
Thursday    
Friday    
Saturday    

typedef mamaDateTimePrecision

typedef enum mamaDateTimePrecision_ mamaDateTimePrecision;

typedef mamaDayOfWeek

typedef enum mamaDayOfWeek_ mamaDayOfWeek;

typedef mamaDateTimeHints

typedef mama_u8_t mamaDateTimeHints;

Functions Documentation

function mamaDateTime_create

MAMAExpDLL mama_status mamaDateTime_create(
    mamaDateTime * dateTime
)

Parameters:

  • dateTime The location of a mamaDateTime to store the result

Create a date/time object.

function mamaDateTime_destroy

MAMAExpDLL mama_status mamaDateTime_destroy(
    mamaDateTime dateTime
)

Parameters:

  • dateTime The date/time object to destroy.

Destroy a mamaDateTime object.

function mamaDateTime_clear

MAMAExpDLL mama_status mamaDateTime_clear(
    mamaDateTime dateTime
)

Parameters:

  • dateTime The date/time object to clear.

Clear a mamaDateTime object.

function mamaDateTime_clearDate

MAMAExpDLL mama_status mamaDateTime_clearDate(
    mamaDateTime dateTime
)

Parameters:

  • dateTime The date/time object to clear (preserving the time of day).

Clear the date part of a mamaDateTime object.

function mamaDateTime_clearTime

MAMAExpDLL mama_status mamaDateTime_clearTime(
    mamaDateTime dateTime
)

Parameters:

  • dateTime The date/time object to clear.

Clear the time of day part of a mamaDateTime object (preserving the date).

function mamaDateTime_copy

MAMAExpDLL mama_status mamaDateTime_copy(
    mamaDateTime dest,
    const mamaDateTime src
)

function mamaDateTime_empty

MAMAExpDLL int mamaDateTime_empty(
    const mamaDateTime dateTime
)

function mamaDateTime_equal

MAMAExpDLL int mamaDateTime_equal(
    const mamaDateTime lhs,
    const mamaDateTime rhs
)

function mamaDateTime_compare

MAMAExpDLL int mamaDateTime_compare(
    const mamaDateTime lhs,
    const mamaDateTime rhs
)

function mamaDateTime_getEpochTimeExt

MAMAExpDLL mama_status mamaDateTime_getEpochTimeExt(
    const mamaDateTime dateTime,
    mama_i64_t * seconds,
    mama_u32_t * nanoseconds
)

Parameters:

  • dateTime The dateTime to use.
  • seconds The number of seconds since the Epoch.
  • nanoseconds The number of nanoseconds since the seconds parameter.

Get the extended datetime values expressed in seconds since the Epoch (UTC) and nanoseconds since this epoch time.

function mamaDateTime_setEpochTimeExt

MAMAExpDLL mama_status mamaDateTime_setEpochTimeExt(
    mamaDateTime dateTime,
    mama_i64_t seconds,
    mama_u32_t nanoseconds
)

Parameters:

  • dateTime The dateTime to use.
  • seconds The number of seconds since the Epoch.
  • microseconds The number of microseconds.
  • precision The precision of the time stamp.

Set the extended datetime from seconds since the Epoch (UTC) and nanoseconds since this epoch time.

function mamaDateTime_setEpochTime

MAMAExpDLL mama_status mamaDateTime_setEpochTime(
    mamaDateTime dateTime,
    mama_u32_t seconds,
    mama_u32_t microseconds,
    mamaDateTimePrecision precision
)

Parameters:

  • dateTime The dateTime to set.
  • seconds The number of seconds since the Epoch.
  • microseconds The number of microseconds.
  • precision The precision of the time stamp.

Set the date and time as seconds and microseconds since the Epoch (UTC time zone) with an option to designate the accuracy of the time.

function mamaDateTime_setEpochTimeF64

MAMAExpDLL mama_status mamaDateTime_setEpochTimeF64(
    mamaDateTime dateTime,
    mama_f64_t seconds
)

Parameters:

  • dateTime The dateTime to set.
  • seconds The number of seconds since the Epoch.

Set the date and time as seconds (plus, possibly fractional seconds) since the Epoch (UTC time zone). Fractional seconds will be rounded to microseconds.

function mamaDateTime_setEpochTimeMilliseconds

MAMAExpDLL mama_status mamaDateTime_setEpochTimeMilliseconds(
    mamaDateTime dateTime,
    mama_u64_t milliseconds
)

Parameters:

  • dateTime The dateTime to set.
  • milliseconds The number of milliseconds since the Epoch.

Set the date and time as milliseconds.

function mamaDateTime_setEpochTimeMicroseconds

MAMAExpDLL mama_status mamaDateTime_setEpochTimeMicroseconds(
    mamaDateTime dateTime,
    mama_u64_t milliseconds
)

Parameters:

  • dateTime The dateTime to set.
  • milliseconds The number of microseconds since the Epoch.

Set the date and time as microseconds.

function mamaDateTime_setWithHints

MAMAExpDLL mama_status mamaDateTime_setWithHints(
    mamaDateTime dateTime,
    mama_u32_t seconds,
    mama_u32_t microseconds,
    mamaDateTimePrecision precision,
    mamaDateTimeHints hints
)

Parameters:

  • dateTime The dateTime to set.
  • seconds The number of seconds (since the Epoch or start-of-day if no date).
  • microseconds The number of microseconds.
  • precision The precision of the date/time stamp.
  • hints Additional hints

Set the date and/or time with special, optional hints to indicate whether the date/time includes date information, time information and/or whether a user of the date/time should consider it in the context of a time zone.

function mamaDateTime_getHints

MAMAExpDLL mama_status mamaDateTime_getHints(
    const mamaDateTime dateTime,
    mamaDateTimeHints * hints
)

Parameters:

  • dateTime The dateTime to use.
  • precision The output precision of the date/time stamp.

Get the hints flags.

function mamaDateTime_setHints

MAMAExpDLL mama_status mamaDateTime_setHints(
    mamaDateTime dateTime,
    mamaDateTimeHints hints
)

Parameters:

  • dateTime The dateTime to set.
  • precision The precision of the date/time stamp.

Set the hints flags.

function mamaDateTime_getPrecision

MAMAExpDLL mama_status mamaDateTime_getPrecision(
    const mamaDateTime dateTime,
    mamaDateTimePrecision * precision
)

Parameters:

  • dateTime The dateTime to use.
  • precision The output precision of the date/time stamp.

Get the precision.

function mamaDateTime_setPrecision

MAMAExpDLL mama_status mamaDateTime_setPrecision(
    mamaDateTime dateTime,
    mamaDateTimePrecision precision
)

Parameters:

  • dateTime The dateTime to set.
  • precision The precision of the date/time stamp.

Set the precision.

function mamaDateTime_setToNow

MAMAExpDLL mama_status mamaDateTime_setToNow(
    mamaDateTime dateTime
)

Parameters:

  • dateTime The dateTime to set.

Set the date and time to the current UTC time. Precision and hints will be set appropriately.

function mamaDateTime_setToMidnightToday

MAMAExpDLL mama_status mamaDateTime_setToMidnightToday(
    mamaDateTime dateTime,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to set.
  • tz The timezone in which the date will be set.

Set the dateTime object to 12am of the current date in the timezone provided (or UTC if NULL).

function mamaDateTime_setWithPrecisionAndTz

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
)

Parameters:

  • dateTime The dateTime to set.
  • year The year (must be 1970 or later).
  • month The month (1 - 12).
  • day The day (1 - 31).
  • hour The hour (0 - 23).
  • minute The minute (0 - 59).
  • second The second (0 - 59).
  • microsecond The second (0 - 999999).
  • precision An explicit precision, if known.
  • tz A timezone to shift from.

Set the entire date and time for the MamaDateTime. The year, month and day parameters must all be integers greater than zero.

function mamaDateTime_setTime

MAMAExpDLL mama_status mamaDateTime_setTime(
    mamaDateTime dateTime,
    mama_u32_t hour,
    mama_u32_t minute,
    mama_u32_t second,
    mama_u32_t microsecond
)

Parameters:

  • dateTime The dateTime to set.
  • hour The hour (0 - 23).
  • minute The minute (0 - 59).
  • second The second (0 - 59).
  • microsecond The microsecond (0 - 999999).

Set the time-of-day portion of the MamaDateTime. The date portion is not affected.

function mamaDateTime_setTimeWithPrecisionAndTz

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
)

Parameters:

  • dateTime The dateTime to set.
  • hour The hour (0 - 23).
  • minute The minute (0 - 59).
  • second The second (0 - 59).
  • microsecond The microsecond (0 - 999999).
  • precision An explicit precision, if known.
  • tz A timezone to shift from.

Set the time-of-day portion of the MamaDateTime with explicit precision. The date portion is not affected.

function mamaDateTime_setDate

MAMAExpDLL mama_status mamaDateTime_setDate(
    mamaDateTime dateTime,
    mama_u32_t year,
    mama_u32_t month,
    mama_u32_t day
)

Parameters:

  • dateTime The dateTime to set.
  • year The year (must be 1970 or later).
  • month The month (1 - 12).
  • day The day (1 - 31).

Set the date portion of the MamaDateTime. The time-of-day portion is not affected.

function mamaDateTime_copyTime

MAMAExpDLL mama_status mamaDateTime_copyTime(
    mamaDateTime dest,
    const mamaDateTime src
)

Parameters:

  • dest The dateTime to copy to.
  • src The dateTime to copy from.

Copy the time-of-day portion of the mamaDateTime. The date portion is not affected.

function mamaDateTime_copyDate

MAMAExpDLL mama_status mamaDateTime_copyDate(
    mamaDateTime dest,
    const mamaDateTime src
)

Parameters:

  • dest The dateTime to copy to.
  • src The dateTime to copy from.

Copy the date portion of the mamaDateTime. The time-of-day portion is not affected.

function mamaDateTime_hasTime

MAMAExpDLL mama_status mamaDateTime_hasTime(
    const mamaDateTime dateTime,
    mama_bool_t * result
)

Parameters:

  • dateTime The dateTime to check.
  • result Address of a bool to store the result. 0 false.

Determine whether the time-of-day portion of the MamaDateTime is set.

function mamaDateTime_hasDate

MAMAExpDLL mama_status mamaDateTime_hasDate(
    const mamaDateTime dateTime,
    mama_bool_t * result
)

Parameters:

  • dateTime The dateTime to check.
  • result Address of mama_bool_t to store the result. 0 false.

Determine whether the date portion of the MamaDateTime is set.

function mamaDateTime_addSeconds

MAMAExpDLL mama_status mamaDateTime_addSeconds(
    mamaDateTime dateTime,
    mama_f64_t seconds
)

Parameters:

  • dateTime The dateTime to set.
  • seconds The number of seconds to add (or subtract).

Add a number of seconds, including fractional seconds (may be negative).

function mamaDateTime_addWholeSeconds

MAMAExpDLL mama_status mamaDateTime_addWholeSeconds(
    mamaDateTime dateTime,
    mama_i32_t seconds
)

Parameters:

  • dateTime The dateTime to set.
  • seconds The number of seconds to add (or subtract).

Add a number of whole seconds (may be negative).

function mamaDateTime_addMicroseconds

MAMAExpDLL mama_status mamaDateTime_addMicroseconds(
    mamaDateTime dateTime,
    mama_i64_t microseconds
)

Parameters:

  • dateTime The dateTime to set.
  • microseconds The number of microseconds to add. Can be positive or negative. Note that there are no restrictions on the magnitude of this value.

Add a number of microseconds (may be negative) Add a number of microseconds (may be negative and greater than 1000000 or less than -1000000).

function mamaDateTime_setFromString

MAMAExpDLL mama_status mamaDateTime_setFromString(
    mamaDateTime dateTime,
    const char * str
)

Parameters:

  • dateTime The dateTime to set.
  • str The string representation of some date and/or time.

Set the date and time from a string representation of format YYYY-mm-dd HH:MM:SS.mmmmmm. (YYYY/mm/dd also works.) The precision of subseconds is determined by the number of digits after the decimal point.

function mamaDateTime_setFromStringWithTz

MAMAExpDLL mama_status mamaDateTime_setFromStringWithTz(
    mamaDateTime dateTime,
    const char * str,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to set.
  • str The string representation of some date and/or time.
  • tz A timezone to shift from.

Set the date and time from a string representation of format YYYY-mm-dd HH:MM:SS.mmmmmm. (YYYY/mm/dd also works.) The precision of subseconds is determined by the number of digits after the decimal point. If tz is not NULL, the time string is assumed to be set in a different time zone and will be adjusted to UTC accordingly.

function mamaDateTime_setFromStringBuffer

MAMAExpDLL mama_status mamaDateTime_setFromStringBuffer(
    mamaDateTime dateTime,
    const char * str,
    mama_size_t strLen
)

Parameters:

  • dateTime The dateTime to set.
  • str The string representation of some date and/or time.
  • strLen The length of the unterminated string date/time.

Set the date and time from an unterminated string representation of format YYYY-mm-dd HH:MM:SS.mmmmmm. (YYYY/mm/dd also works.) The precision of subseconds is determined by the number of digits after the decimal point.

function mamaDateTime_setFromStringBufferWithTz

MAMAExpDLL mama_status mamaDateTime_setFromStringBufferWithTz(
    mamaDateTime dateTime,
    const char * str,
    mama_size_t strLen,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to set.
  • str The string representation of some date and/or time.
  • strLen The length of the unterminated string date/time.
  • tz A timezone to shift from.

Set the date and time from an unterminated string representation of format YYYY-mm-dd HH:MM:SS.mmmmmm. (YYYY/mm/dd also works.) The precision of subseconds is determined by the number of digits after the decimal point. If tz is not NULL, the time string is assumed to be set in a different time zone and will be adjusted to UTC accordingly.

function mamaDateTime_getEpochTime

MAMAExpDLL mama_status mamaDateTime_getEpochTime(
    const mamaDateTime dateTime,
    mama_u32_t * seconds,
    mama_u32_t * microseconds,
    mamaDateTimePrecision * precision
)

Parameters:

  • dateTime The dateTime to set.
  • seconds The number of seconds since the Epoch.
  • microseconds The number of additional microseconds.
  • precision The precision of the returned time value.

Get the date and time as seconds and microseconds since the Epoch (UTC time zone).

function mamaDateTime_getEpochTimeWithTz

MAMAExpDLL mama_status mamaDateTime_getEpochTimeWithTz(
    const mamaDateTime dateTime,
    mama_u32_t * seconds,
    mama_u32_t * microseconds,
    mamaDateTimePrecision * precision,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to set.
  • seconds The number of seconds since the Epoch.
  • microseconds The number of additional microseconds.
  • precision The precision of the returned time value.
  • tz The timezone for the returned values.

Get the date and time as seconds and microseconds since the Epoch in the timezone supplied.

function mamaDateTime_getEpochTimeMicroseconds

MAMAExpDLL mama_status mamaDateTime_getEpochTimeMicroseconds(
    const mamaDateTime dateTime,
    mama_u64_t * microseconds
)

Parameters:

  • dateTime The dateTime to obtain the number of microseconds from.
  • microseconds The number of microseconds since the Epoch.

Return: Indicates whether the function succeeded or failed and could be one of:

  • MAMA_STATUS_INVALID_ARG
  • MAMA_STATUS_OK

Get the date and time as microseconds since the Epoch, (using the UTC timezone).

function mamaDateTime_getEpochTimeMicrosecondsWithTz

MAMAExpDLL mama_status mamaDateTime_getEpochTimeMicrosecondsWithTz(
    const mamaDateTime dateTime,
    mama_u64_t * microseconds,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to obtain the number of microseconds from.
  • microseconds The number of microseconds since the Epoch.
  • [int] tz The timezone.

Return: Indicates whether the function succeeded or failed and could be one of:

  • MAMA_STATUS_INVALID_ARG
  • MAMA_STATUS_OK

Get the date and time as microseconds since the Epoch in the supplied time zone.

function mamaDateTime_getEpochTimeMilliseconds

MAMAExpDLL mama_status mamaDateTime_getEpochTimeMilliseconds(
    const mamaDateTime dateTime,
    mama_u64_t * milliseconds
)

Parameters:

  • dateTime The dateTime to set.
  • milliseconds The number of milliseconds since the Epoch.

Get the date and time as milliseconds since the Epoch (UTC time zone).

function mamaDateTime_getEpochTimeMillisecondsWithTz

MAMAExpDLL mama_status mamaDateTime_getEpochTimeMillisecondsWithTz(
    const mamaDateTime dateTime,
    mama_u64_t * milliseconds,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to set.
  • milliseconds The number of milliseconds since the Epoch.
  • tz The timezone for the returned values.

Get the date and time as milliseconds since the Epoch in the timezone supplied.

function mamaDateTime_getEpochTimeSeconds

MAMAExpDLL mama_status mamaDateTime_getEpochTimeSeconds(
    const mamaDateTime dateTime,
    mama_f64_t * seconds
)

Parameters:

  • dateTime The dateTime to set
  • seconds The number of seconds (including partial seconds) since the Epoch.

Get the date and time as seconds since the Epoch (UTC time zone).

function mamaDateTime_getEpochTimeSecondsWithCheck

MAMAExpDLL mama_status mamaDateTime_getEpochTimeSecondsWithCheck(
    const mamaDateTime dateTime,
    mama_f64_t * seconds
)

Parameters:

  • dateTime The dateTime to obtain the number of microseconds from.
  • seconds The number of seconds, (including partial seconds), since the Epoch.

Return: Indicates whether the function succeeded or failed and could be one of:

  • MAMA_STATUS_INVALID_ARG
  • MAMA_STATUS_SYSTEM_ERROR
  • MAMA_STATUS_NULL_ARG
  • MAMA_STATUS_OK

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.

function mamaDateTime_getEpochTimeSecondsWithTz

MAMAExpDLL mama_status mamaDateTime_getEpochTimeSecondsWithTz(
    const mamaDateTime dateTime,
    mama_f64_t * seconds,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to set
  • seconds The number of seconds (including partial seconds) since the Epoch.
  • tz The timezone for the returned values.

Get the date and time as seconds since the Epoch in the timezone supplied.

function mamaDateTime_getWithHints

MAMAExpDLL mama_status mamaDateTime_getWithHints(
    const mamaDateTime dateTime,
    mama_u32_t * seconds,
    mama_u32_t * microseconds,
    mamaDateTimePrecision * precision,
    mama_u8_t * hints
)

Parameters:

  • dateTime The dateTime to set.
  • seconds The number of seconds (since the Epoch or start-of-day if no date).
  • microseconds The number of microseconds.
  • precision The precision of the date/time stamp.
  • hints Additional hints

Get the date and/or time with special, optional hints to indicate whether the date/time includes date information, time information and/or whether a user of the date/time should consider it in the context of a time zone.

function mamaDateTime_getStructTimeVal

MAMAExpDLL mama_status mamaDateTime_getStructTimeVal(
    const mamaDateTime dateTime,
    struct timeval * result
)

Parameters:

  • dateTime The dateTime to set.
  • result The struct timeval to fill in.

Get the date/time as a “struct timeval”.

function mamaDateTime_getStructTimeValWithTz

MAMAExpDLL mama_status mamaDateTime_getStructTimeValWithTz(
    const mamaDateTime dateTime,
    struct timeval * result,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to set.
  • result The struct timeval to fill in.
  • tz The timezone for the returned values.

Get the date/time as a “struct timeval” in the timezone supplied.

function mamaDateTime_setFromStructTimeVal

MAMAExpDLL mama_status mamaDateTime_setFromStructTimeVal(
    const mamaDateTime dateTime,
    struct timeval * inputTimeVal
)

Parameters:

  • dateTime The dateTime to update.
  • inputTimeVal The timeval struct to be used to update the dateTime.

Set the date/time from a “struct timeval”.

function mamaDateTime_getStructTm

MAMAExpDLL mama_status mamaDateTime_getStructTm(
    const mamaDateTime dateTime,
    struct tm * result
)

Parameters:

  • dateTime The dateTime to set.
  • result The struct timeval to fill in.

Get the date/time as a “struct tm”.

function mamaDateTime_getStructTmWithTz

MAMAExpDLL mama_status mamaDateTime_getStructTmWithTz(
    const mamaDateTime dateTime,
    struct tm * result,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to set.
  • result The struct timeval to fill in.
  • tz The timezone for the returned values.

Get the date/time as a “struct tm” in the timezone supplied.

function mamaDateTime_getAsString

MAMAExpDLL mama_status mamaDateTime_getAsString(
    const mamaDateTime dateTime,
    char * str,
    mama_size_t maxLen
)

Parameters:

  • dateTime The dateTime to set.
  • str The string buffer to update.
  • maxLen The maximum size of the string buffer (including trailing ‘\0’).

Get the date and/or time as a string. If no date information is available, no date is printed in the resulting string. The format for dates is YYYY-mm-dd (the ISO 8601 date format) and the format for times is HH:MM:SS.mmmmmmm (where the precision of the subseconds may vary depending upon any precision hints available).

The timezone must to set to UTC if calling this from multiple threads concurrently to avoid contention in strftime.

function mamaDateTime_getTimeAsString

MAMAExpDLL mama_status mamaDateTime_getTimeAsString(
    const mamaDateTime dateTime,
    char * str,
    mama_size_t maxLen
)

Parameters:

  • dateTime The dateTime to set.
  • str The string buffer to update.
  • maxLen The maximum size of the string buffer (including trailing ‘\0’).

Get the time (no date) as a string. The format for times is HH:MM:SS.mmmmmmm (where the precision of the subseconds may vary depending upon any precision hints available).

The timezone must to set to UTC if calling this from multiple threads concurrently to avoid contention in strftime.

function mamaDateTime_getDateAsString

MAMAExpDLL mama_status mamaDateTime_getDateAsString(
    const mamaDateTime dateTime,
    char * str,
    mama_size_t maxLen
)

Parameters:

  • dateTime The dateTime to set.
  • str The string buffer to update.
  • maxLen The maximum size of the string buffer (including trailing ‘\0’).

Get the date (no time) as a string. The format for dates is YYYY-mm-dd (the ISO 8601 date format).

The timezone must to set to UTC if calling this from multiple threads concurrently to avoid contention in strftime.

function mamaDateTime_getAsFormattedString

MAMAExpDLL mama_status mamaDateTime_getAsFormattedString(
    const mamaDateTime dateTime,
    char * str,
    mama_size_t maxLen,
    const char * format
)

Parameters:

  • dateTime The dateTime to set.
  • str The string buffer to update.
  • maxLen The maximum size of the string buffer (including trailing ‘\0’).
  • format The output format.

Get the date and/or time as a string using the format provided. The format string can be the common ones supported by strftime() (Y, m, d, F, T, Y, H, M, S, B, b, h, ), with the additional format strings, “%:” and “%;”, which represents the number of subseconds in millis. “%;” includes the dot and only prints the subseconds if they are non-zero. “%:” does not include the dot, and prints “000” for 0 milliseconds. “%.” and “%,” are identical to “%:” and “%;” except they use the internal precision field to determine how many decimal places to print.

function mamaDateTime_getAsFormattedStringWithTz

MAMAExpDLL mama_status mamaDateTime_getAsFormattedStringWithTz(
    const mamaDateTime dateTime,
    char * str,
    mama_size_t maxLen,
    const char * format,
    const mamaTimeZone tz
)

Parameters:

  • dateTime The dateTime to set.
  • str The string buffer to update.
  • maxLen The maximum size of the string buffer (including trailing ‘\0’).
  • format The output format.
  • tz The timezone for the returned date/time.

Get the date and/or time as a string using the format provided. The format string can be the common ones supported by strftime() (Y, m, d, F, T, Y, H, M, S, B, b, h, ), with the additional format strings, “%:” and “%;”, which represents the number of subseconds in millis. “%;” includes the dot and only prints the subseconds if they are non-zero. “%:” does not include the dot, and prints “000” for 0 milliseconds. “%.” and “%,” are identical to “%:” and “%;” except they use the internal precision field to determine how many decimal places to print.

function mamaDateTime_getYear

MAMAExpDLL mama_status mamaDateTime_getYear(
    const mamaDateTime dateTime,
    mama_u32_t * result
)

Parameters:

  • dateTime The dateTime from which to get the result.
  • result The result of the get method.

Get the year (1601 onwards).

function mamaDateTime_getMonth

MAMAExpDLL mama_status mamaDateTime_getMonth(
    const mamaDateTime dateTime,
    mama_u32_t * result
)

Parameters:

  • dateTime The dateTime from which to get the result.
  • result The result of the get method.

Get the month (1-12).

function mamaDateTime_getDay

MAMAExpDLL mama_status mamaDateTime_getDay(
    const mamaDateTime dateTime,
    mama_u32_t * result
)

Parameters:

  • dateTime The dateTime from which to get the result.
  • result The result of the get method.

Get the day of month (1-31).

function mamaDateTime_getHour

MAMAExpDLL mama_status mamaDateTime_getHour(
    const mamaDateTime dateTime,
    mama_u32_t * result
)

Parameters:

  • dateTime The dateTime from which to get the result.
  • result The result of the get method.

Get the hour (0-23).

function mamaDateTime_getMinute

MAMAExpDLL mama_status mamaDateTime_getMinute(
    const mamaDateTime dateTime,
    mama_u32_t * result
)

Parameters:

  • dateTime The dateTime from which to get the result.
  • result The result of the get method.

Get the minute (0-59).

function mamaDateTime_getSecond

MAMAExpDLL mama_status mamaDateTime_getSecond(
    const mamaDateTime dateTime,
    mama_u32_t * result
)

Parameters:

  • dateTime The dateTime from which to get the result.
  • result The result of the get method.

Get the second (0-59).

function mamaDateTime_getMicrosecond

MAMAExpDLL mama_status mamaDateTime_getMicrosecond(
    const mamaDateTime dateTime,
    mama_u32_t * result
)

Parameters:

  • dateTime The dateTime from which to get the result.
  • result The result of the get method.

Get the microsecond (0-999999).

function mamaDateTime_getDayOfWeek

MAMAExpDLL mama_status mamaDateTime_getDayOfWeek(
    const mamaDateTime dateTime,
    mamaDayOfWeek * result
)

Parameters:

  • dateTime The dateTime from which to get the result.
  • result The result of the get method.

Get the day of week.

function mamaDateTime_diffSeconds

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.

function mamaDateTime_diffSecondsSameDay

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, ignoring any date information.

function mamaDateTime_diffMicroseconds

MAMAExpDLL mama_status mamaDateTime_diffMicroseconds(
    const mamaDateTime t1,
    const mamaDateTime t0,
    mama_i64_t * result
)

Return the difference, in microseconds, between the two times.

function mamaDateTime_setFromStructTimeSpec

MAMAExpDLL mama_status mamaDateTime_setFromStructTimeSpec(
    const mamaDateTime dateTime,
    struct timespec * inputTimeVal
)

Parameters:

  • dateTime The dateTime to update.
  • inputTimeVal The timespec struct to be used to update the dateTime.

Set the date/time from a “struct timespec”.

function mamaDateTime_getStructTimeSpec

MAMAExpDLL mama_status mamaDateTime_getStructTimeSpec(
    const mamaDateTime dateTime,
    struct timespec * result
)

Parameters:

  • dateTime The dateTime to set.
  • result The struct timespec to fill in.

Get the date/time as a “struct timespec”.

Macros Documentation

define MAMA_DATE_TIME_HAS_DATE

#define MAMA_DATE_TIME_HAS_DATE ((mamaDateTimeHints) 0x01)

define MAMA_DATE_TIME_HAS_TIME

#define MAMA_DATE_TIME_HAS_TIME ((mamaDateTimeHints) 0x02)

define MAMA_DATE_TIME_NO_TIMEZONE

#define MAMA_DATE_TIME_NO_TIMEZONE ((mamaDateTimeHints) 0x04)

Source code

/* $Id$
 *
 * OpenMAMA: The open middleware agnostic messaging API
 * Copyright (C) 2011 NYSE Technologies, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#include <mama/config.h>
#include <mama/status.h>
#include <mama/types.h>
#include <mama/timezone.h>
#include "wombat/port.h"

#include <time.h>
#ifndef MamaDateTimeH__
#define MamaDateTimeH__


#if defined(__cplusplus)
extern "C" {
#endif


typedef enum mamaDateTimePrecision_
{
    MAMA_DATE_TIME_PREC_SECONDS      = 0,
    MAMA_DATE_TIME_PREC_DECISECONDS  = 1,
    MAMA_DATE_TIME_PREC_CENTISECONDS = 2,
    MAMA_DATE_TIME_PREC_MILLISECONDS = 3,
    MAMA_DATE_TIME_PREC_MICROSECONDS = 6,
    MAMA_DATE_TIME_PREC_NANOSECONDS  = 9,
    MAMA_DATE_TIME_PREC_DAYS         = 10,
    MAMA_DATE_TIME_PREC_MINUTES      = 12,
    MAMA_DATE_TIME_PREC_UNKNOWN      = 15
} mamaDateTimePrecision;

typedef enum mamaDayOfWeek_
{
    Sunday = 0, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
} mamaDayOfWeek;


typedef mama_u8_t  mamaDateTimeHints;
#define MAMA_DATE_TIME_HAS_DATE    ((mamaDateTimeHints) 0x01)
#define MAMA_DATE_TIME_HAS_TIME    ((mamaDateTimeHints) 0x02)
#define MAMA_DATE_TIME_NO_TIMEZONE ((mamaDateTimeHints) 0x04)


MAMAExpDLL
extern mama_status
mamaDateTime_create (mamaDateTime* dateTime);

MAMAExpDLL
extern mama_status
mamaDateTime_destroy (mamaDateTime dateTime);

MAMAExpDLL
extern mama_status
mamaDateTime_clear (mamaDateTime dateTime);

MAMAExpDLL
extern mama_status
mamaDateTime_clearDate (mamaDateTime dateTime);

MAMAExpDLL
extern mama_status
mamaDateTime_clearTime (mamaDateTime dateTime);

/*
 * Copy a date/time object.  The destination object must have already
 * been allocated using mamaDateTime_create().
 */
MAMAExpDLL
extern mama_status
mamaDateTime_copy (mamaDateTime       dest,
                   const mamaDateTime src);

/*
 * Check whether the date/time object has been set to anything
 */
MAMAExpDLL
extern int
mamaDateTime_empty (const mamaDateTime dateTime);

/*
 * Check for equality between two date/time objects.
 */
MAMAExpDLL
extern int
mamaDateTime_equal (const mamaDateTime lhs,
                    const mamaDateTime rhs);

/*
 * Compare two date/time objects.  The return value is negative if lhs
 * is earlier than rhs, positive if lhs is greater than rhs and zero
 * if the two are equal.
 */
MAMAExpDLL
extern int
mamaDateTime_compare (const mamaDateTime lhs,
                      const mamaDateTime rhs);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeExt(const mamaDateTime     dateTime,
                             mama_i64_t*            seconds,
                             mama_u32_t*            nanoseconds);

MAMAExpDLL
extern mama_status
mamaDateTime_setEpochTimeExt(mamaDateTime           dateTime,
                             mama_i64_t             seconds,
                             mama_u32_t             nanoseconds);
MAMAExpDLL
extern mama_status
mamaDateTime_setEpochTime(mamaDateTime           dateTime,
                          mama_u32_t             seconds,
                          mama_u32_t             microseconds,
                          mamaDateTimePrecision  precision);

MAMAExpDLL
extern mama_status
mamaDateTime_setEpochTimeF64(mamaDateTime dateTime,
                             mama_f64_t   seconds);

MAMAExpDLL
extern mama_status
mamaDateTime_setEpochTimeMilliseconds(mamaDateTime dateTime,
                                      mama_u64_t   milliseconds);

MAMAExpDLL
extern mama_status
mamaDateTime_setEpochTimeMicroseconds(mamaDateTime dateTime,
                                      mama_u64_t   milliseconds);

MAMAExpDLL
extern mama_status
mamaDateTime_setWithHints(mamaDateTime           dateTime,
                          mama_u32_t             seconds,
                          mama_u32_t             microseconds,
                          mamaDateTimePrecision  precision,
                          mamaDateTimeHints      hints);


MAMAExpDLL
extern mama_status
mamaDateTime_getHints(const mamaDateTime     dateTime,
                      mamaDateTimeHints*     hints);

MAMAExpDLL
extern mama_status
mamaDateTime_setHints(mamaDateTime           dateTime,
                      mamaDateTimeHints      hints);

MAMAExpDLL
extern mama_status
mamaDateTime_getPrecision(const mamaDateTime     dateTime,
                          mamaDateTimePrecision* precision);

MAMAExpDLL
extern mama_status
mamaDateTime_setPrecision(mamaDateTime           dateTime,
                          mamaDateTimePrecision  precision);

MAMAExpDLL
extern mama_status
mamaDateTime_setToNow(mamaDateTime dateTime);

MAMAExpDLL
extern mama_status
mamaDateTime_setToMidnightToday(mamaDateTime       dateTime,
                                const mamaTimeZone tz);

MAMAExpDLL
extern 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);

MAMAExpDLL
extern mama_status
mamaDateTime_setTime(mamaDateTime dateTime,
                     mama_u32_t   hour,
                     mama_u32_t   minute,
                     mama_u32_t   second,
                     mama_u32_t   microsecond);

MAMAExpDLL
extern 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);

MAMAExpDLL
extern mama_status
mamaDateTime_setDate(mamaDateTime dateTime,
                     mama_u32_t   year,
                     mama_u32_t   month,
                     mama_u32_t   day);

MAMAExpDLL
extern mama_status
mamaDateTime_copyTime (mamaDateTime       dest,
                       const mamaDateTime src);

MAMAExpDLL
extern mama_status
mamaDateTime_copyDate (mamaDateTime       dest,
                       const mamaDateTime src);

MAMAExpDLL
extern mama_status
mamaDateTime_hasTime(const mamaDateTime dateTime,
                     mama_bool_t*       result);

MAMAExpDLL
extern mama_status
mamaDateTime_hasDate(const mamaDateTime dateTime,
                     mama_bool_t*       result);

MAMAExpDLL
extern mama_status
mamaDateTime_addSeconds(mamaDateTime dateTime,
                        mama_f64_t   seconds);

MAMAExpDLL
extern mama_status
mamaDateTime_addWholeSeconds(mamaDateTime dateTime,
                             mama_i32_t   seconds);

MAMAExpDLL
extern mama_status
mamaDateTime_addMicroseconds(mamaDateTime dateTime,
                             mama_i64_t   microseconds);

MAMAExpDLL
extern mama_status
mamaDateTime_setFromString(mamaDateTime dateTime,
                           const char*  str);

MAMAExpDLL
extern mama_status
mamaDateTime_setFromStringWithTz(mamaDateTime        dateTime,
                                 const char*         str,
                                 const mamaTimeZone  tz);

MAMAExpDLL
extern mama_status
mamaDateTime_setFromStringBuffer(mamaDateTime dateTime,
                                 const char*  str,
                                 mama_size_t  strLen);

MAMAExpDLL
extern mama_status
mamaDateTime_setFromStringBufferWithTz(mamaDateTime       dateTime,
                                       const char*        str,
                                       mama_size_t        strLen,
                                       const mamaTimeZone tz);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTime(const mamaDateTime     dateTime,
                          mama_u32_t*            seconds,
                          mama_u32_t*            microseconds,
                          mamaDateTimePrecision* precision);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeWithTz(const mamaDateTime     dateTime,
                                mama_u32_t*            seconds,
                                mama_u32_t*            microseconds,
                                mamaDateTimePrecision* precision,
                                const mamaTimeZone     tz);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeMicroseconds(const mamaDateTime dateTime,
                                      mama_u64_t*        microseconds);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeMicrosecondsWithTz(const mamaDateTime dateTime,
                                            mama_u64_t*        microseconds,
                                            const mamaTimeZone tz);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeMilliseconds(const mamaDateTime dateTime,
                                      mama_u64_t*        milliseconds);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeMillisecondsWithTz(const mamaDateTime dateTime,
                                            mama_u64_t*        milliseconds,
                                            const mamaTimeZone tz);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeSeconds(const mamaDateTime dateTime,
                                 mama_f64_t*        seconds);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeSecondsWithCheck(const mamaDateTime dateTime,
                                          mama_f64_t*        seconds);

MAMAExpDLL
extern mama_status
mamaDateTime_getEpochTimeSecondsWithTz(const mamaDateTime dateTime,
                                       mama_f64_t*        seconds,
                                       const mamaTimeZone tz);

MAMAExpDLL
extern mama_status
mamaDateTime_getWithHints(const mamaDateTime     dateTime,
                          mama_u32_t*            seconds,
                          mama_u32_t*            microseconds,
                          mamaDateTimePrecision* precision,
                          mama_u8_t*             hints);

MAMAExpDLL
extern mama_status
mamaDateTime_getStructTimeVal(const mamaDateTime dateTime,
                              struct timeval*    result);

MAMAExpDLL
extern mama_status
mamaDateTime_getStructTimeValWithTz(const mamaDateTime dateTime,
                                    struct timeval*    result,
                                    const mamaTimeZone tz);

MAMAExpDLL
extern mama_status
mamaDateTime_setFromStructTimeVal(const mamaDateTime dateTime,
                                  struct timeval*    inputTimeVal);

MAMAExpDLL
extern mama_status
mamaDateTime_getStructTm(const mamaDateTime dateTime,
                         struct tm*         result);

MAMAExpDLL
extern mama_status
mamaDateTime_getStructTmWithTz(const mamaDateTime dateTime,
                               struct tm*         result,
                               const mamaTimeZone tz);

MAMAExpDLL
extern mama_status
mamaDateTime_getAsString(const mamaDateTime dateTime,
                         char*              str,
                         mama_size_t        maxLen);

MAMAExpDLL
extern mama_status
mamaDateTime_getTimeAsString(const mamaDateTime dateTime,
                             char*              str,
                             mama_size_t        maxLen);

MAMAExpDLL
extern mama_status
mamaDateTime_getDateAsString(const mamaDateTime dateTime,
                             char*              str,
                             mama_size_t        maxLen);

MAMAExpDLL
extern mama_status
mamaDateTime_getAsFormattedString(const mamaDateTime dateTime,
                                  char*              str,
                                  mama_size_t        maxLen,
                                  const char*        format);

MAMAExpDLL
extern mama_status
mamaDateTime_getAsFormattedStringWithTz(const mamaDateTime dateTime,
                                        char*              str,
                                        mama_size_t        maxLen,
                                        const char*        format,
                                        const mamaTimeZone tz);

MAMAExpDLL
extern mama_status
mamaDateTime_getYear(const mamaDateTime dateTime,
                     mama_u32_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_getMonth(const mamaDateTime dateTime,
                      mama_u32_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_getDay(const mamaDateTime dateTime,
                    mama_u32_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_getHour(const mamaDateTime dateTime,
                     mama_u32_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_getMinute(const mamaDateTime dateTime,
                       mama_u32_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_getSecond(const mamaDateTime dateTime,
                       mama_u32_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_getMicrosecond(const mamaDateTime dateTime,
                            mama_u32_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_getDayOfWeek(const mamaDateTime dateTime,
                          mamaDayOfWeek*     result);

MAMAExpDLL
extern mama_status
mamaDateTime_diffSeconds(const mamaDateTime t1,
                         const mamaDateTime t0,
                         mama_f64_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_diffSecondsSameDay(const mamaDateTime t1,
                                const mamaDateTime t0,
                                mama_f64_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_diffMicroseconds(const mamaDateTime t1,
                              const mamaDateTime t0,
                              mama_i64_t*        result);

MAMAExpDLL
extern mama_status
mamaDateTime_setFromStructTimeSpec(const mamaDateTime dateTime,
                                   struct timespec*   inputTimeVal);

MAMAExpDLL
extern mama_status
mamaDateTime_getStructTimeSpec(const mamaDateTime dateTime,
                               struct timespec*   result);

#if defined(__cplusplus)
}
#endif

#endif

Updated on 2023-03-31 at 15:29:16 +0100