omaha_client::time

Struct ComplexTime

Source
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

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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.

Source§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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>,