Struct nakamoto_test::block::time::LocalTime
pub struct LocalTime { /* private fields */ }
Expand description
Local time.
This clock is monotonic.
Implementations
impl LocalTime
impl LocalTime
pub const fn from_secs(secs: u64) -> LocalTime
pub const fn from_secs(secs: u64) -> LocalTime
Construct a local time from whole seconds since Epoch.
pub fn duration_since(&self, earlier: LocalTime) -> LocalDuration
pub fn duration_since(&self, earlier: LocalTime) -> LocalDuration
Get the duration since the given time.
Panics
This function will panic if earlier
is later than self
.
pub fn diff(&self, other: LocalTime) -> LocalDuration
pub fn diff(&self, other: LocalTime) -> LocalDuration
Get the difference between two times.
pub fn elapse(&mut self, duration: LocalDuration)
pub fn elapse(&mut self, duration: LocalDuration)
Elapse time.
Adds the given duration to the time.
Trait Implementations
impl Add<LocalDuration> for LocalTime
impl Add<LocalDuration> for LocalTime
Add a duration to a local time. Yields a local time.
sourceimpl Clock for LocalTime
impl Clock for LocalTime
sourcefn block_time(&self) -> u32
fn block_time(&self) -> u32
Return the local time as seconds since Epoch.
This is the same representation as used in block header timestamps. Read more
sourcefn local_time(&self) -> LocalTime
fn local_time(&self) -> LocalTime
Tell the time in local time.
sourcefn from_block_time(t: u32) -> LocalTime
fn from_block_time(t: u32) -> LocalTime
Create a clock from a block time.
impl From<SystemTime> for LocalTime
impl From<SystemTime> for LocalTime
Convert a SystemTime
into a local time.
fn from(system: SystemTime) -> LocalTime
fn from(system: SystemTime) -> LocalTime
Converts to this type from the input type.
impl Ord for LocalTime
impl Ord for LocalTime
1.21.0 · sourcefn 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 · sourcefn 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
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
impl PartialOrd<LocalTime> for LocalTime
impl PartialOrd<LocalTime> for LocalTime
fn partial_cmp(&self, other: &LocalTime) -> Option<Ordering>
fn partial_cmp(&self, other: &LocalTime) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Sub<LocalDuration> for LocalTime
impl Sub<LocalDuration> for LocalTime
Substract a duration from a local time. Yields a local time.
impl Sub<LocalTime> for LocalTime
impl Sub<LocalTime> for LocalTime
Substract two local times. Yields a duration.
type Output = LocalDuration
type Output = LocalDuration
The resulting type after applying the
-
operator.fn sub(self, other: LocalTime) -> LocalDuration
fn sub(self, other: LocalTime) -> LocalDuration
Performs the
-
operation. Read moreimpl Copy for LocalTime
impl Eq for LocalTime
impl StructuralEq for LocalTime
impl StructuralPartialEq for LocalTime
Auto Trait Implementations
impl RefUnwindSafe for LocalTime
impl Send for LocalTime
impl Sync for LocalTime
impl Unpin for LocalTime
impl UnwindSafe for LocalTime
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more