pub struct TimeOfDay(/* private fields */);Expand description
Represents a timezone-free clock time with microsecond precision.
Shared and distinct values support concurrent reads. See Self::new.
Implementations§
Source§impl TimeOfDay
impl TimeOfDay
Sourcepub fn new(
hour: u32,
minute: u32,
second: u32,
microsecond: u32,
) -> Result<Self>
pub fn new( hour: u32, minute: u32, second: u32, microsecond: u32, ) -> Result<Self>
Creates a clock time without leap-second support.
§Errors
Returns Error::InvalidInput unless hour is 0..=23, minute and second
are 0..=59, and microsecond is 0..=999_999.
§Examples
use kiyosi::{Date, TimeOfDay};
let close = TimeOfDay::new(15, 0, 0, 123_456)?;
let observation = Date::new(2025, 1, 2)?.at_time(close);
assert_eq!(observation.time_of_day(), close);
assert_eq!(close.micros_since_midnight(), 54_000_123_456);Sourcepub fn micros_since_midnight(self) -> u64
pub fn micros_since_midnight(self) -> u64
Returns microseconds since midnight; see Self::new.
Trait Implementations§
impl Copy for TimeOfDay
impl Eq for TimeOfDay
Source§impl Ord for TimeOfDay
impl Ord for TimeOfDay
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for TimeOfDay
impl PartialOrd for TimeOfDay
impl StructuralPartialEq for TimeOfDay
Auto Trait Implementations§
impl Freeze for TimeOfDay
impl RefUnwindSafe for TimeOfDay
impl Send for TimeOfDay
impl Sync for TimeOfDay
impl Unpin for TimeOfDay
impl UnsafeUnpin for TimeOfDay
impl UnwindSafe for TimeOfDay
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more