pub struct Instant {
pub millis: i64,
}
Expand description
A representation of an absolute time value.
The Instant
type is a wrapper around a i64
value that
represents a number of milliseconds, monotonically increasing
since an arbitrary moment in time, such as system startup.
- A value of
0
is inherently arbitrary. - A value less than
0
indicates a time before the starting point.
Fields§
§millis: i64
Implementations§
source§impl Instant
impl Instant
sourcepub fn from_millis(millis: i64) -> Instant
pub fn from_millis(millis: i64) -> Instant
Create a new Instant
from a number of milliseconds.
sourcepub fn now() -> Instant
pub fn now() -> Instant
Create a new Instant
from the current std::time::SystemTime.
sourcepub fn millis(&self) -> i64
pub fn millis(&self) -> i64
The fractional number of milliseconds that have passed since the beginning of time.
sourcepub fn secs(&self) -> i64
pub fn secs(&self) -> i64
The number of whole seconds that have passed since the beginning of time.
sourcepub fn total_millis(&self) -> i64
pub fn total_millis(&self) -> i64
The total number of milliseconds that have passed since the biginning of time.
Trait Implementations§
source§impl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+=
operation. Read moresource§impl From<SystemTime> for Instant
impl From<SystemTime> for Instant
source§fn from(other: SystemTime) -> Instant
fn from(other: SystemTime) -> Instant
Converts to this type from the input type.
source§impl Into<SystemTime> for Instant
impl Into<SystemTime> for Instant
source§fn into(self) -> SystemTime
fn into(self) -> SystemTime
Converts this type into the (usually inferred) input type.
source§impl Ord for Instant
impl Ord for Instant
source§impl PartialOrd<Instant> for Instant
impl PartialOrd<Instant> for Instant
1.0.0 · source§fn 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 moresource§impl SubAssign<Duration> for Instant
impl SubAssign<Duration> for Instant
source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
Performs the
-=
operation. Read more