TimeOfDay¶
An hour:minute:second.nanosecond within a day, with no date and no zone. Range: 00:00:00.000_000_000 .. 23:59:59.999_999_999. No leap-second representation (POSIX model).
Constructors¶
create¶
Construct from hour/minute/second/nanosecond. Errors if any field is out of range.
new val create(
hour': U8 val,
minute': U8 val,
second': U8 val,
nano': I32 val = 0)
: TimeOfDay val^ ?
Parameters¶
Returns¶
- TimeOfDay val^ ?
midnight¶
00:00:00.000_000_000 — non-partial because midnight is always valid. Used for stubs and as a safe default.
Returns¶
- TimeOfDay val^
noon¶
12:00:00.000_000_000 — non-partial; always valid.
Returns¶
- TimeOfDay val^
from_total_nanos¶
Construct from nanoseconds since midnight (0 .. 86_399_999_999_999).
Errors if n is out of range. Inverse of total_nanos().
Parameters¶
- n: I64 val
Returns¶
- TimeOfDay val^ ?
Public Functions¶
hour¶
Returns¶
- U8 val
minute¶
Returns¶
- U8 val
second¶
Returns¶
- U8 val
nano¶
Returns¶
- I32 val
total_nanos¶
Nanoseconds since midnight: 0 .. 86_399_999_999_999.
Returns¶
- I64 val
compare¶
Parameters¶
- other: TimeOfDay val
Returns¶
eq¶
Parameters¶
- other: TimeOfDay val
Returns¶
- Bool val
ne¶
Parameters¶
- other: TimeOfDay val
Returns¶
- Bool val
lt¶
Parameters¶
- other: TimeOfDay val
Returns¶
- Bool val
le¶
Parameters¶
- other: TimeOfDay val
Returns¶
- Bool val
gt¶
Parameters¶
- other: TimeOfDay val
Returns¶
- Bool val
ge¶
Parameters¶
- other: TimeOfDay val
Returns¶
- Bool val
add_nanos¶
Return (new TimeOfDay, days-overflow). Adds n nanoseconds, wrapping
within the day; overflow days are reported so the caller can apply
them to a Date or ZonedDateTime.
n may be negative, in which case days-overflow can be negative.
Example: 23:00 + 2h yields (01:00, +1); 01:00 + (-2h) yields (23:00, -1).
Parameters¶
- n: I64 val
Returns¶
string¶
ISO 8601 time format. Emits "HH:MM:SS" when nanoseconds are zero, or "HH:MM:SS.nnnnnnnnn" (zero-padded to 9 digits) otherwise.
Returns¶
- String iso^