time

A time is a time of day, with an optional timezone offset.

Strings have the form HH:MM:SS with an optional timezone suffix, where seconds may be a decimal value, for example, “12:13:14”, “12:13:14.56”, or “12:13:14.56-07:00”.

Canonical form only includes a decimal point if the number of seconds isn’t an integer. This implementation supports up to nanosecond resolution. Note that midnight at the end of the day (like “24:00:00”) is a valid lexical form, but unlike dateTime, 24 isn’t a valid hour value. Such forms will be read as 00:00:00.

EXESS_MAX_TIME_LENGTH

24U

The maximum length of a time string from exess_write_time()

struct ExessTime

Time.

ExessTimezone zone

Timezone offset in quarter hours.

uint8_t hour

Hour: [0, 23].

uint8_t minute

Minute: [0, 59].

uint8_t second

Second: [0, 59].

uint32_t nanosecond

Nanosecond: [0, 999999999].

ExessOrder exess_compare_time(ExessTime lhs, ExessTime rhs)

Compare two times.

Note that local and zoned times may not be comparable. See exess_compare_date_time() for details.

Returns:

Less than, equal to, or greater than zero if lhs is less than, equal to, or greater than rhs, respectively. Comparable and incomparable cases may also be distinguished, see ExessOrder for details.

ExessResult exess_read_time(const char *str, ExessTime *out)

Read a time string after any leading whitespace.

Parameters:
  • str – String to read.

  • out – Parsed value, or zero on error.

Returns:

The count of characters read, and a status.

ExessResult exess_write_time(ExessTime value, size_t buf_size, char *buf)

Write a canonical time string.

The output is always in canonical form, like “12:15” or “02:00Z”.

Parameters:
  • value – Value to write.

  • buf_size – Size of buf in bytes.

  • buf – Output buffer, or null to only measure.

Returns:

ExessStatus.EXESS_SUCCESS on success, ExessStatus.EXESS_NO_SPACE if the buffer is too small, or ExessStatus.EXESS_BAD_VALUE if the value is invalid.