data TimeOfDay
Wall-clock time of day, 00:00:00 .. 23:59:59.999999999 (§17.1): TimeOfDay(18, 0).
Example:
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 TimeOfDayThread 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 | () -> i64Nanoseconds since midnight. |
ofNanosOfDay | (n: i64) -> TimeOfDay | InvalidValueThe time of day n nanoseconds after midnight. |
fmt | (pattern: str) -> strFormats with a pattern (HH:mm); an empty pattern is ISO 8601. |
show | () -> strThe time in ISO 8601 form. |
parse | (text: str, format: TimeFormat | str) -> TimeOfDay | ParseErrorParses a time of day in ISO 8601 form or with a pattern (HH:mm). |
Defined in: std/time/time.oxl:1151