pub struct ComplexTime {
    pub wall: SystemTime,
    pub mono: Instant,
}
Expand description

This is a complete ComplexTime, which has values on both the wall clock timeline and the monotonic clock timeline.

It is not necessarily intended that both values refer to the same moment. They can, or they can refer to a time on each clock’s respective timeline, e.g. for use with the Timer trait.

The ComplexTime type implements all the standard math operations in std::ops that are implemented for both std::time::SystemTime and std::time::Instant. Like those implementations, it will panic on overflow.

Fields§

§wall: SystemTime§mono: Instant

Implementations§

source§

impl ComplexTime

source

pub fn truncate_submicrosecond_walltime(&self) -> ComplexTime

Truncate the submicrosecond part of the walltime.

source

pub fn wall_duration_since( &self, earlier: impl Into<SystemTime> ) -> Result<Duration, SystemTimeError>

Compute the Duration since the given SystemTime, for the SystemTime component of this ComplexTime. If this ComplexTime’s SystemTime is before the given time, the Duration is returned as Err (same as SystemTime::duration_since())

source

pub fn is_after_or_eq_any(&self, other: impl Into<PartialComplexTime>) -> bool

Returns true if this ComplexTime is after either the SystemTime or the Instant of the given PartialComplexTime.

Trait Implementations§

source§

impl Add<Duration> for ComplexTime

§

type Output = ComplexTime

The resulting type after applying the + operator.
source§

fn add(self, dur: Duration) -> Self

Performs the + operation. Read more
source§

impl AddAssign<Duration> for ComplexTime

AddAssign implementation that relies on the above Add implementation.

source§

fn add_assign(&mut self, other: Duration)

Performs the += operation. Read more
source§

impl Clone for ComplexTime

source§

fn clone(&self) -> ComplexTime

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ComplexTime

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for ComplexTime

ComplexTime implements Display to provide a human-readable, detailed, format for its values. It uses the ReadableSystemTime struct for its SystemTime component, and the Debug trait implementation of Instant, as that type’s internals are not accessible, and it only implements Debug.

§Example

use omaha_client::time::ComplexTime;
use std::time::{Duration, Instant, SystemTime};
assert_eq!(
    format!("{}", ComplexTime{
                      wall: SystemTime::UNIX_EPOCH + Duration::from_nanos(994610096026420000),
                      mono: Instant::now(),
                  }),
    "2001-07-08 16:34:56.026 UTC (994610096.026420000) at Instant{ tv_sec: SEC, tv_nsec: NSEC }"
);
source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<(SystemTime, Instant)> for ComplexTime

source§

fn from(t: (SystemTime, Instant)) -> ComplexTime

Converts to this type from the input type.
source§

impl From<ComplexTime> for Instant

source§

fn from(complex: ComplexTime) -> Instant

Converts to this type from the input type.
source§

impl From<ComplexTime> for Option<PartialComplexTime>

source§

fn from(t: ComplexTime) -> Self

Converts to this type from the input type.
source§

impl From<ComplexTime> for PartialComplexTime

source§

fn from(t: ComplexTime) -> Self

Converts to this type from the input type.
source§

impl From<ComplexTime> for SystemTime

source§

fn from(complex: ComplexTime) -> SystemTime

Converts to this type from the input type.
source§

impl Hash for ComplexTime

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for ComplexTime

source§

fn eq(&self, other: &ComplexTime) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub<Duration> for ComplexTime

A Sub implementation for ComplexTime that subtracts the duration from both times that the ComplexTime holds.

§

type Output = ComplexTime

The resulting type after applying the - operator.
source§

fn sub(self, dur: Duration) -> Self

Performs the - operation. Read more
source§

impl SubAssign<Duration> for ComplexTime

AddAssign implementation that relies on the above Add implementation.

source§

fn sub_assign(&mut self, other: Duration)

Performs the -= operation. Read more
source§

impl Copy for ComplexTime

source§

impl Eq for ComplexTime

source§

impl StructuralPartialEq for ComplexTime

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Unless for T

source§

fn unless(self, option: Option<T>) -> T

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T
where T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,