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
timestring fromexess_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].
-
ExessTimezone zone¶
-
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
lhsis less than, equal to, or greater thanrhs, respectively. Comparable and incomparable cases may also be distinguished, seeExessOrderfor details.
-
ExessResult exess_read_time(const char *str, ExessTime *out)¶
Read a
timestring after any leading whitespace.- Parameters:
str – String to read.
out – Parsed value, or zero on error.
- Returns:
The
countof characters read, and astatus.
-
ExessResult exess_write_time(ExessTime value, size_t buf_size, char *buf)¶
Write a canonical
timestring.The output is always in canonical form, like “12:15” or “02:00Z”.
- Parameters:
value – Value to write.
buf_size – Size of
bufin bytes.buf – Output buffer, or null to only measure.
- Returns:
ExessStatus.EXESS_SUCCESSon success,ExessStatus.EXESS_NO_SPACEif the buffer is too small, orExessStatus.EXESS_BAD_VALUEif the value is invalid.