#[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) -> Time
pub const fn from_i64(nanos: i64) -> Time
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) -> Time
pub const fn from_hms(hour: i64, min: i64, sec: i64) -> Time
Creates a Time instance from hours, minutes, and seconds.
sourcepub const fn from_hms_milli(hour: i64, min: i64, sec: i64, milli: i64) -> Time
pub const fn from_hms_milli(hour: i64, min: i64, sec: i64, milli: i64) -> Time
Creates a Time instance from hours, minutes, seconds, and milliseconds.
sourcepub const fn from_hms_micro(hour: i64, min: i64, sec: i64, micro: i64) -> Time
pub const fn from_hms_micro(hour: i64, min: i64, sec: i64, micro: i64) -> Time
Creates a Time instance from hours, minutes, seconds, and microseconds.
sourcepub const fn from_hms_nano(hour: i64, min: i64, sec: i64, nano: i64) -> Time
pub const fn from_hms_nano(hour: i64, min: i64, sec: i64, nano: i64) -> Time
Creates a Time instance from hours, minutes, seconds, and nanoseconds.
sourcepub const fn from_num_seconds_from_midnight(secs: i64, nano: i64) -> Time
pub const fn from_num_seconds_from_midnight(secs: i64, nano: i64) -> Time
Creates a Time instance from the number of seconds since midnight and additional nanoseconds.
Trait Implementations§
source§impl IsNone for Time
impl IsNone for Time
type Inner = Time
type Cast<U: IsNone<Inner = U> + Clone> = U
source§fn to_opt(self) -> Option<Self::Inner>
fn to_opt(self) -> Option<Self::Inner>
Option<Self::Inner>. Read moresource§fn as_opt(&self) -> Option<&Self::Inner>
fn as_opt(&self) -> Option<&Self::Inner>
Option<&Self::Inner>. Read moresource§fn from_inner(inner: Self::Inner) -> Self
fn from_inner(inner: Self::Inner) -> Self
Self from the given inner value. Read morefn unwrap(self) -> Self::Inner
source§fn map<F, U: IsNone>(self, f: F) -> U
fn map<F, U: IsNone>(self, f: F) -> U
Self, if it exists. Read moresource§fn from_opt(opt: Option<Self::Inner>) -> Self
fn from_opt(opt: Option<Self::Inner>) -> Self
Self from an Option<Self::Inner>.fn not_none(&self) -> bool
source§fn sort_cmp(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
fn sort_cmp(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
None as the largest value. Read moresource§fn sort_cmp_rev(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
fn sort_cmp_rev(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
None as the largest value. Read moresource§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<Time>
fn with_hour(&self, hour: u32) -> Option<Time>
source§fn with_minute(&self, min: u32) -> Option<Time>
fn with_minute(&self, min: u32) -> Option<Time>
source§fn with_second(&self, sec: u32) -> Option<Time>
fn with_second(&self, sec: u32) -> Option<Time>
source§fn with_nanosecond(&self, nano: u32) -> Option<Time>
fn with_nanosecond(&self, nano: u32) -> Option<Time>
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)