logo
pub struct PreciseTime(_);
Expand description

An opaque structure representing a moment in time.

The only operation that can be performed on a PreciseTime is the calculation of the Duration of time that lies between them.

Examples

Repeatedly call a function for 1 second:

use time::{Duration, PreciseTime};

let start = PreciseTime::now();

while start.to(PreciseTime::now()) < Duration::seconds(1) {
    do_some_work();
}

Implementations

Returns a PreciseTime representing the current moment in time.

Returns a Duration representing the span of time from the value of self to the value of later.

Notes

If later represents a time before self, the result of this method is unspecified.

If later represents a time more than 293 years after self, the result of this method is unspecified.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.