GATE
|
Date and time management and conversion functions. More...
Functions | |
GATE_CORE_API gate_result_t | gate_date_to_time (gate_datetime_t const *source, gate_time_t *dest) |
Converts a gregorian date and daytime into a time value. | |
GATE_CORE_API gate_result_t | gate_date_to_string (gate_datetime_t const *date, gate_int16_t bias, char const *format, char *dest, gate_size_t *destsize) |
Prints a date structure into a string using the specified format. | |
GATE_CORE_API gate_size_t | gate_date_parse_string (char const *source, gate_size_t sourcelen, gate_datetime_t *dest, gate_int16_t *bias) |
Parses a ISO 8601 time string and fills a datetime record with contents. | |
GATE_CORE_API gate_size_t | gate_date_parse_month (char const *source, gate_size_t sourcelen, gate_uint8_t *mon) |
Parses a calendar month name into a month number. | |
GATE_CORE_API gate_day_id_t | gate_date_to_day_id (gate_date_t const *date) |
Converts a gregorian date to a unique day-id (counted days since 1601-01-01) | |
GATE_CORE_API gate_result_t | gate_date_from_day_id (gate_day_id_t day_id, gate_date_t *date) |
Converts a day-id into a gregorian date structure. | |
GATE_CORE_API gate_uint8_t | gate_date_day_of_week (gate_day_id_t day_id) |
Returns the week-day id of the given day-id. | |
GATE_CORE_API gate_uint16_t | gate_date_day_of_year (gate_date_t const *date) |
Returns day count of day within year of the given gregorian date. | |
GATE_CORE_API gate_uint8_t | gate_date_week_of_year (gate_date_t const *date, gate_bool_t monday_starts_week) |
Returns the week-count within year of the given gregorian date. | |
GATE_CORE_API gate_result_t | gate_time_now (gate_time_t *now) |
Returns the current time from the system's clock. | |
GATE_CORE_API gate_result_t | gate_time_to_datetime (gate_time_t const *source, gate_datetime_t *dest) |
Converts a time structure into a gregorian date-time structure. | |
GATE_CORE_API gate_result_t | gate_time_to_string (gate_time_t const *source, char const *format, char *dest, gate_size_t *destsize) |
Prints time structure as a formated string. | |
GATE_CORE_API gate_result_t | gate_time_parse_string (char const *source, gate_size_t sourcelen, gate_time_t *dest) |
Parses ISO8601 formated time string into a time-structure. | |
GATE_CORE_API gate_result_t | gate_time_from_unix (gate_int64_t sourceunixseconds, gate_timestamp_t *dest) |
Converts UNIX-timestamp into GATE timestamp. | |
GATE_CORE_API gate_result_t | gate_time_from_timestamp (gate_timestamp_t source, gate_time_t *dest) |
Converts timestamp into time-structure. | |
GATE_CORE_API gate_result_t | gate_time_to_unix (gate_timestamp_t sourcetime, gate_int64_t *destunixseconds) |
Converts GATE timestamp into UNIX timestamp. | |
GATE_CORE_API gate_day_id_t | gate_time_to_day_id (gate_timestamp_t timestamp) |
Converts GATE timestamp into day-id. | |
GATE_CORE_API gate_result_t | gate_time_from_day_id (gate_day_id_t day_id, gate_timestamp_t *dest) |
Creates a GATE timestamp from a day-id. | |
GATE_CORE_API gate_result_t | gate_timecounter_now (gate_timecounter_t *now) |
Creates a monotonic timestamp from the system's clock. | |
GATE_CORE_API gate_int64_t | gate_timecounter_diff (gate_timecounter_t tc1, gate_timecounter_t tc2) |
Returns the difference of two timecounter value (returnvalue = tc1 - tc2) | |
GATE_CORE_API gate_timecounter_t | gate_timecounter_add (gate_timecounter_t tc, gate_int64_t microseconds) |
Creates a new timecounter value by adding microseconds to a given timecounter. | |
Date and time management and conversion functions.
GATE_CORE_API gate_result_t gate_date_to_time | ( | gate_datetime_t const * | source, |
gate_time_t * | dest ) |
Converts a gregorian date and daytime into a time value.
[in] | source | pointer to input datetime structure |
[out] | dest | pointer to output time structure |
GATE_CORE_API gate_result_t gate_date_to_string | ( | gate_datetime_t const * | date, |
gate_int16_t | bias, | ||
char const * | format, | ||
char * | dest, | ||
gate_size_t * | destsize ) |
Prints a date structure into a string using the specified format.
[in] | date | pointer to input datetime structure |
[in] | bias | bias in minutes of the given datetime structure compared to UTC |
[in] | format | format string for time representation (NULL == ISO 8601, which is "{YYYY}-{MM}-{DD}T{hh}:{mm}:{ss}.{SSS}{bias}") |
[out] | dest | pointer to output string buffer |
[in,out] | destsize | pointer to size of string buffer, retrieving the consumed bytes afterwards |
GATE_CORE_API gate_size_t gate_date_parse_string | ( | char const * | source, |
gate_size_t | sourcelen, | ||
gate_datetime_t * | dest, | ||
gate_int16_t * | bias ) |
Parses a ISO 8601 time string and fills a datetime record with contents.
[in] | source | pointer to source string to be parsed |
[in] | sourcelen | length of source string in bytes |
[out] | dest | pointer to output date-time structure |
[out] | bias | pointer to output bias in minutes from UTC |
GATE_CORE_API gate_size_t gate_date_parse_month | ( | char const * | source, |
gate_size_t | sourcelen, | ||
gate_uint8_t * | mon ) |
Parses a calendar month name into a month number.
[in] | source | pointer to source string to be parsed |
[in] | sourcelen | length of source string in bytes |
[out] | mon | pointer to output month number |
GATE_CORE_API gate_day_id_t gate_date_to_day_id | ( | gate_date_t const * | date | ) |
Converts a gregorian date to a unique day-id (counted days since 1601-01-01)
[in] | date | pointer to date structure to be converted |
GATE_CORE_API gate_result_t gate_date_from_day_id | ( | gate_day_id_t | day_id, |
gate_date_t * | date ) |
Converts a day-id into a gregorian date structure.
[in] | day_id | pointer to source string to be parsed |
[out] | date | pointer to output date-time structure |
GATE_CORE_API gate_uint8_t gate_date_day_of_week | ( | gate_day_id_t | day_id | ) |
Returns the week-day id of the given day-id.
[in] | day_id | id of day to be used |
GATE_CORE_API gate_uint16_t gate_date_day_of_year | ( | gate_date_t const * | date | ) |
Returns day count of day within year of the given gregorian date.
[in] | date | pointer to date to be analyzed |
GATE_CORE_API gate_uint8_t gate_date_week_of_year | ( | gate_date_t const * | date, |
gate_bool_t | monday_starts_week ) |
Returns the week-count within year of the given gregorian date.
[in] | date | pointer to date to be analyzed |
[in] | monday_starts_week | true=starts with monday, false=starts with sunday |
GATE_CORE_API gate_result_t gate_time_now | ( | gate_time_t * | now | ) |
Returns the current time from the system's clock.
[out] | now | Pointer to time structure retrieving the current time |
GATE_CORE_API gate_result_t gate_time_to_datetime | ( | gate_time_t const * | source, |
gate_datetime_t * | dest ) |
Converts a time structure into a gregorian date-time structure.
[in] | source | pointer to input time structure |
[out] | dest | pointer to output date-time structure |
GATE_CORE_API gate_result_t gate_time_to_string | ( | gate_time_t const * | source, |
char const * | format, | ||
char * | dest, | ||
gate_size_t * | destsize ) |
Prints time structure as a formated string.
[in] | source | pointer to input time structure |
[in] | format | format output string (NULL == ISO8601) |
[out] | dest | pointer to output string buffer |
[in,out] | destsize | pointer to output string capacity, receives used bytes afterwards |
GATE_CORE_API gate_result_t gate_time_parse_string | ( | char const * | source, |
gate_size_t | sourcelen, | ||
gate_time_t * | dest ) |
Parses ISO8601 formated time string into a time-structure.
[in] | source | pointer to input string |
[in] | sourcelen | length of source string in bytes |
[out] | dest | pointer to output time structure |
GATE_CORE_API gate_result_t gate_time_from_unix | ( | gate_int64_t | sourceunixseconds, |
gate_timestamp_t * | dest ) |
Converts UNIX-timestamp into GATE timestamp.
[in] | sourceunixseconds | Unix time in seconds since 1970-01-01 00:00 |
[out] | dest | pointer to output time structure |
GATE_CORE_API gate_result_t gate_time_from_timestamp | ( | gate_timestamp_t | source, |
gate_time_t * | dest ) |
Converts timestamp into time-structure.
[in] | source | timestamp value to be converted |
[out] | dest | Pointer to output time-structure |
GATE_CORE_API gate_result_t gate_time_to_unix | ( | gate_timestamp_t | sourcetime, |
gate_int64_t * | destunixseconds ) |
Converts GATE timestamp into UNIX timestamp.
[in] | sourcetime | GATE timestamp (Microseconds since 1601-01-01) |
[out] | destunixseconds | pointer to output UNIX timestamp |
GATE_CORE_API gate_day_id_t gate_time_to_day_id | ( | gate_timestamp_t | timestamp | ) |
Converts GATE timestamp into day-id.
[in] | timestamp | GATE timestamp (Microseconds since 1601-01-01) |
GATE_CORE_API gate_result_t gate_time_from_day_id | ( | gate_day_id_t | day_id, |
gate_timestamp_t * | dest ) |
Creates a GATE timestamp from a day-id.
[in] | day_id | days since 1601-01-01 |
[out] | dest | pointer to output GATE timestamp |
GATE_CORE_API gate_result_t gate_timecounter_now | ( | gate_timecounter_t * | now | ) |
Creates a monotonic timestamp from the system's clock.
[out] | now | pointer to output timecounter value |
GATE_CORE_API gate_int64_t gate_timecounter_diff | ( | gate_timecounter_t | tc1, |
gate_timecounter_t | tc2 ) |
Returns the difference of two timecounter value (returnvalue = tc1 - tc2)
[in] | tc1 | first timecounter value |
[in] | tc2 | second timecounter value |
GATE_CORE_API gate_timecounter_t gate_timecounter_add | ( | gate_timecounter_t | tc, |
gate_int64_t | microseconds ) |
Creates a new timecounter value by adding microseconds to a given timecounter.
[in] | tc | days since 1601-01-01 |
[out] | microseconds | amount of microseconds to be added to timecounter value |