#[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.
Trait Implementations§
source§impl Ord for Time
impl Ord for Time
source§impl PartialOrd for Time
impl PartialOrd for Time
source§impl Timelike for Time
impl Timelike for Time
source§fn nanosecond(&self) -> u32
fn nanosecond(&self) -> u32
source§fn with_hour(&self, hour: u32) -> Option<Self>
fn with_hour(&self, hour: u32) -> Option<Self>
source§fn with_minute(&self, min: u32) -> Option<Self>
fn with_minute(&self, min: u32) -> Option<Self>
source§fn with_second(&self, sec: u32) -> Option<Self>
fn with_second(&self, sec: u32) -> Option<Self>
source§fn with_nanosecond(&self, nano: u32) -> Option<Self>
fn with_nanosecond(&self, nano: u32) -> Option<Self>
source§fn hour12(&self) -> (bool, u32)
fn hour12(&self) -> (bool, u32)
source§fn num_seconds_from_midnight(&self) -> u32
fn num_seconds_from_midnight(&self) -> u32
impl Copy for Time
impl Eq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)