pub struct TimeSpan { /* private fields */ }Expand description
An interval in between time stamps. This type is used to represent durations with nanosecond precision.
Implementations§
Source§impl TimeSpan
impl TimeSpan
Sourcepub const NANOSECOND: Self
pub const NANOSECOND: Self
One nanosecond span. Minimal possible time span supported by this type.
Sourcepub const MICROSECOND: Self
pub const MICROSECOND: Self
One microsecond span.
Sourcepub const MILLISECOND: Self
pub const MILLISECOND: Self
One millisecond span.
Sourcepub const JULIAN_YEAR: Self
pub const JULIAN_YEAR: Self
One Julian year. Average year length in Julian calendar. Defined as 365.25 days.
Sourcepub const GREGORIAN_YEAR: Self
pub const GREGORIAN_YEAR: Self
One Gregorian year. Average year length in Gregorian calendar. Defined as 365.2425 days.
Sourcepub const SOLAR_YEAR: Self
pub const SOLAR_YEAR: Self
One solar year (tropical year). Defined as 365.24219 days.
Sourcepub const YEAR: Self = Self::SOLAR_YEAR
pub const YEAR: Self = Self::SOLAR_YEAR
One year. Closest value to the average length of a year on Earth.
Sourcepub const fn as_millis(&self) -> u64
pub const fn as_millis(&self) -> u64
Returns number of whole milliseconds this value represents.
Sourcepub const fn as_seconds(&self) -> u64
pub const fn as_seconds(&self) -> u64
Returns number of whole seconds this value represents.
Sourcepub const fn as_minutes(&self) -> u64
pub const fn as_minutes(&self) -> u64
Returns number of whole minutes this value represents.
Sourcepub fn as_secs_f32(&self) -> f32
pub fn as_secs_f32(&self) -> f32
Returns number of seconds as floating point value. This function should be used for small-ish spans when high precision is not required.
Sourcepub fn as_secs_f64(&self) -> f64
pub fn as_secs_f64(&self) -> f64
Returns number of seconds as high precision floating point value.
pub const fn checked_add(self, span: TimeSpan) -> Option<TimeSpan>
pub const fn checked_sub(self, span: TimeSpan) -> Option<TimeSpan>
pub const fn checked_mul(self, value: u64) -> Option<TimeSpan>
pub const fn checked_div(self, value: u64) -> Option<TimeSpan>
pub const fn div(self, value: NonZeroU64) -> TimeSpan
pub const fn checked_div_span(self, span: TimeSpan) -> Option<u64>
pub const fn div_span(self, span: NonZeroTimeSpan) -> u64
pub const fn checked_rem(self, value: u64) -> Option<TimeSpan>
pub const fn rem(self, value: NonZeroU64) -> TimeSpan
pub const fn checked_rem_span(self, span: TimeSpan) -> Option<TimeSpan>
pub const fn rem_span(self, span: NonZeroTimeSpan) -> TimeSpan
pub const fn hms(hours: u64, minutes: u64, seconds: u64) -> TimeSpan
pub const fn dhms(days: u64, hours: u64, minutes: u64, seconds: u64) -> TimeSpan
Trait Implementations§
Source§impl AddAssign<TimeSpan> for TimeStamp
impl AddAssign<TimeSpan> for TimeStamp
Source§fn add_assign(&mut self, rhs: TimeSpan)
fn add_assign(&mut self, rhs: TimeSpan)
+= operation. Read moreSource§impl AddAssign for TimeSpan
impl AddAssign for TimeSpan
Source§fn add_assign(&mut self, rhs: TimeSpan)
fn add_assign(&mut self, rhs: TimeSpan)
+= operation. Read moreSource§impl DivAssign<NonZero<u64>> for TimeSpan
impl DivAssign<NonZero<u64>> for TimeSpan
Source§fn div_assign(&mut self, rhs: NonZeroU64)
fn div_assign(&mut self, rhs: NonZeroU64)
/= operation. Read moreSource§impl DivAssign<u64> for TimeSpan
impl DivAssign<u64> for TimeSpan
Source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/= operation. Read moreSource§impl Mul<TimeSpan> for NonZeroU64
impl Mul<TimeSpan> for NonZeroU64
Source§impl MulAssign<NonZero<u64>> for TimeSpan
impl MulAssign<NonZero<u64>> for TimeSpan
Source§fn mul_assign(&mut self, rhs: NonZeroU64)
fn mul_assign(&mut self, rhs: NonZeroU64)
*= operation. Read moreSource§impl MulAssign<u64> for TimeSpan
impl MulAssign<u64> for TimeSpan
Source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*= operation. Read moreSource§impl Ord for TimeSpan
impl Ord for TimeSpan
Source§impl PartialOrd for TimeSpan
impl PartialOrd for TimeSpan
Source§impl RemAssign<NonZero<u64>> for TimeSpan
impl RemAssign<NonZero<u64>> for TimeSpan
Source§fn rem_assign(&mut self, rhs: NonZeroU64)
fn rem_assign(&mut self, rhs: NonZeroU64)
%= operation. Read moreSource§impl RemAssign<u64> for TimeSpan
impl RemAssign<u64> for TimeSpan
Source§fn rem_assign(&mut self, rhs: u64)
fn rem_assign(&mut self, rhs: u64)
%= operation. Read moreSource§impl RemAssign for TimeSpan
impl RemAssign for TimeSpan
Source§fn rem_assign(&mut self, rhs: TimeSpan)
fn rem_assign(&mut self, rhs: TimeSpan)
%= operation. Read moreSource§impl SubAssign for TimeSpan
impl SubAssign for TimeSpan
Source§fn sub_assign(&mut self, rhs: TimeSpan)
fn sub_assign(&mut self, rhs: TimeSpan)
-= operation. Read more