#[repr(transparent)]pub struct Time(pub i64);Expand description
Represents a time of day with nanosecond precision.
This struct is a wrapper around an i64 value representing the number of nanoseconds
since midnight. It provides various methods for creating, manipulating, and converting
time values.
Tuple Fields§
§0: i64Implementations§
Source§impl Time
impl Time
Sourcepub const fn from_i64(nanos: i64) -> Self
pub const fn from_i64(nanos: i64) -> Self
Creates a new Time instance from the given number of nanoseconds.
Sourcepub const fn is_nat(&self) -> bool
pub const fn is_nat(&self) -> bool
Checks if the time is “not a time” (NAT).
Returns true if the internal value is i64::MIN, which represents an invalid time.
Sourcepub const fn is_not_nat(&self) -> bool
pub const fn is_not_nat(&self) -> bool
Checks if the time is a valid time (not NAT).
Returns true if the internal value is not i64::MIN.
Sourcepub const fn as_cr(&self) -> Option<NaiveTime>
pub const fn as_cr(&self) -> Option<NaiveTime>
Converts the Time instance to a chrono::NaiveTime, if valid.
Sourcepub const fn from_hms(hour: i64, min: i64, sec: i64) -> Self
pub const fn from_hms(hour: i64, min: i64, sec: i64) -> Self
Creates a Time instance from hours, minutes, and seconds.
Sourcepub const fn from_hms_milli(hour: i64, min: i64, sec: i64, milli: i64) -> Self
pub const fn from_hms_milli(hour: i64, min: i64, sec: i64, milli: i64) -> Self
Creates a Time instance from hours, minutes, seconds, and milliseconds.
Sourcepub const fn from_hms_micro(hour: i64, min: i64, sec: i64, micro: i64) -> Self
pub const fn from_hms_micro(hour: i64, min: i64, sec: i64, micro: i64) -> Self
Creates a Time instance from hours, minutes, seconds, and microseconds.
Sourcepub const fn from_hms_nano(hour: i64, min: i64, sec: i64, nano: i64) -> Self
pub const fn from_hms_nano(hour: i64, min: i64, sec: i64, nano: i64) -> Self
Creates a Time instance from hours, minutes, seconds, and nanoseconds.
Sourcepub const fn from_num_seconds_from_midnight(secs: i64, nano: i64) -> Self
pub const fn from_num_seconds_from_midnight(secs: i64, nano: i64) -> Self
Creates a Time instance from the number of seconds since midnight and additional nanoseconds.