OxL Reference

data TimeOfDay

Wall-clock time of day, 00:00:00 .. 23:59:59.999999999 (§17.1): TimeOfDay(18, 0).

Example:

oxl✓ checked in CI
use std.time { TimeOfDay }

fn main() io {
  let t = TimeOfDay{ hour: 18, minute: 30 }
  print("{t.show()} {t.nanosOfDay() / 1000000000}")
}
Output
18:30:00 66600
@derive(Copy, Eq, Hash)
pub(api) data TimeOfDay

Thread safety. an immutable value.

Since. 1.0.0-beta

Fields

pub(api) hour: i64

Hour, 0..23.

pub(api) minute: i64

Minute, 0..59.

pub(api) second: i64 = 0

Second, 0..59.

pub(api) nano: i64 = 0

Nanosecond of the second.

Methods

nanosOfDay() -> i64
Nanoseconds since midnight.
ofNanosOfDay(n: i64) -> TimeOfDay | InvalidValue
The time of day n nanoseconds after midnight.
fmt(pattern: str) -> str
Formats with a pattern (HH:mm); an empty pattern is ISO 8601.
show() -> str
The time in ISO 8601 form.
parse(text: str, format: TimeFormat | str) -> TimeOfDay | ParseError
Parses a time of day in ISO 8601 form or with a pattern (HH:mm).

Defined in: std/time/time.oxl:1151

See also