logo
pub struct SystemTime { /* private fields */ }
Expand description

A measurement of the system clock, useful for talking to external entities like the file system or other processes.

This corresponds to std::time::SystemTime.

This SystemTime has no now, elapsed methods. To obtain the current time or measure the duration to the current time, first obtain a SystemClock, and then call SystemClock::now or SystemClock::elapsed instead. The UNIX_EPOCH constant is at SystemClock::UNIX_EPOCH.

Similar to the filetime crate, when RUSTFLAGS=--cfg emulate_second_only_system is set, SystemTime will round times from the operating system down to the second. This emulates the behavior of some file systems, mostly HFS, allowing debugging on other hardware.

Implementations

Constructs a new instance of Self from the given std::time::SystemTime.

Constructs a new instance of std::time::SystemTime from the given Self.

Returns the amount of time elapsed from another instant to this one.

This corresponds to std::time::SystemTime::duration_since.

Returns Some(t) where t is the time self + duration if t can be represented as SystemTime (which means it’s inside the bounds of the underlying data structure), None otherwise.

This corresponds to std::time::SystemTime::checked_add.

Returns Some(t) where t is the time self - duration if t can be represented as SystemTime (which means it’s inside the bounds of the underlying data structure), None otherwise.

This corresponds to std::time::SystemTime::checked_sub.

Trait Implementations

Panics

This function may panic if the resulting point in time cannot be represented by the underlying data structure. See SystemTime::checked_add for a version without panic.

The resulting type after applying the + operator.
Performs the += operation. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
Performs the -= operation. 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
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.