#[repr(C)]pub struct TimeSpan {
pub duration: i64,
}Fields§
§duration: i64Implementations§
Source§impl TimeSpan
impl TimeSpan
Sourcepub const TICKS_PER_MICROSECOND: i64 = TICKS_PER_MICROSECOND
pub const TICKS_PER_MICROSECOND: i64 = TICKS_PER_MICROSECOND
The number of 100-nanosecond ticks per microsecond.
Sourcepub const TICKS_PER_MILLISECOND: i64 = TICKS_PER_MILLISECOND
pub const TICKS_PER_MILLISECOND: i64 = TICKS_PER_MILLISECOND
The number of 100-nanosecond ticks per millisecond.
Sourcepub const TICKS_PER_SECOND: i64 = TICKS_PER_SECOND
pub const TICKS_PER_SECOND: i64 = TICKS_PER_SECOND
The number of 100-nanosecond ticks per second.
Sourcepub const TICKS_PER_MINUTE: i64 = TICKS_PER_MINUTE
pub const TICKS_PER_MINUTE: i64 = TICKS_PER_MINUTE
The number of 100-nanosecond ticks per minute.
Sourcepub const TICKS_PER_HOUR: i64 = TICKS_PER_HOUR
pub const TICKS_PER_HOUR: i64 = TICKS_PER_HOUR
The number of 100-nanosecond ticks per hour.
Sourcepub const TICKS_PER_DAY: i64 = TICKS_PER_DAY
pub const TICKS_PER_DAY: i64 = TICKS_PER_DAY
The number of 100-nanosecond ticks per day.
Sourcepub const fn from_ticks(ticks: i64) -> TimeSpan
pub const fn from_ticks(ticks: i64) -> TimeSpan
Constructs a TimeSpan from a raw count of 100-nanosecond ticks.
Sourcepub const fn from_micros(micros: i64) -> TimeSpan
pub const fn from_micros(micros: i64) -> TimeSpan
Constructs a TimeSpan from a number of microseconds, saturating on overflow.
Sourcepub const fn from_millis(millis: i64) -> TimeSpan
pub const fn from_millis(millis: i64) -> TimeSpan
Constructs a TimeSpan from a number of milliseconds, saturating on overflow.
Sourcepub const fn from_seconds(seconds: i64) -> TimeSpan
pub const fn from_seconds(seconds: i64) -> TimeSpan
Constructs a TimeSpan from a number of seconds, saturating on overflow.
Sourcepub const fn from_minutes(minutes: i64) -> TimeSpan
pub const fn from_minutes(minutes: i64) -> TimeSpan
Constructs a TimeSpan from a number of minutes, saturating on overflow.
Sourcepub const fn from_hours(hours: i64) -> TimeSpan
pub const fn from_hours(hours: i64) -> TimeSpan
Constructs a TimeSpan from a number of hours, saturating on overflow.
Sourcepub const fn from_days(days: i64) -> TimeSpan
pub const fn from_days(days: i64) -> TimeSpan
Constructs a TimeSpan from a number of days, saturating on overflow.
Sourcepub const fn whole_micros(self) -> i64
pub const fn whole_micros(self) -> i64
Returns the total number of whole microseconds in this TimeSpan.
Sourcepub const fn whole_millis(self) -> i64
pub const fn whole_millis(self) -> i64
Returns the total number of whole milliseconds in this TimeSpan.
Sourcepub const fn whole_seconds(self) -> i64
pub const fn whole_seconds(self) -> i64
Returns the total number of whole seconds in this TimeSpan.
Sourcepub const fn whole_minutes(self) -> i64
pub const fn whole_minutes(self) -> i64
Returns the total number of whole minutes in this TimeSpan.
Sourcepub const fn whole_hours(self) -> i64
pub const fn whole_hours(self) -> i64
Returns the total number of whole hours in this TimeSpan.
Sourcepub const fn whole_days(self) -> i64
pub const fn whole_days(self) -> i64
Returns the total number of whole days in this TimeSpan.
Sourcepub const fn whole_nanos(self) -> i128
pub const fn whole_nanos(self) -> i128
Returns the total duration as a count of nanoseconds.
Sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Returns true if this TimeSpan is negative.
Sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Returns true if this TimeSpan is positive (strictly greater than zero).
Sourcepub const fn abs(self) -> TimeSpan
pub const fn abs(self) -> TimeSpan
Returns the absolute value of this TimeSpan, saturating at MAX when
applied to MIN.
Sourcepub const fn checked_add(self, rhs: TimeSpan) -> Option<TimeSpan>
pub const fn checked_add(self, rhs: TimeSpan) -> Option<TimeSpan>
Checked addition. Returns None on overflow.
Sourcepub const fn checked_sub(self, rhs: TimeSpan) -> Option<TimeSpan>
pub const fn checked_sub(self, rhs: TimeSpan) -> Option<TimeSpan>
Checked subtraction. Returns None on overflow.
Sourcepub const fn checked_neg(self) -> Option<TimeSpan>
pub const fn checked_neg(self) -> Option<TimeSpan>
Checked negation. Returns None when applied to MIN.
Sourcepub const fn checked_mul(self, rhs: i64) -> Option<TimeSpan>
pub const fn checked_mul(self, rhs: i64) -> Option<TimeSpan>
Checked multiplication by an integer. Returns None on overflow.
Sourcepub const fn checked_div(self, rhs: i64) -> Option<TimeSpan>
pub const fn checked_div(self, rhs: i64) -> Option<TimeSpan>
Checked division by an integer. Returns None if rhs is zero or on
overflow.
Sourcepub const fn saturating_add(self, rhs: TimeSpan) -> TimeSpan
pub const fn saturating_add(self, rhs: TimeSpan) -> TimeSpan
Saturating addition.
Sourcepub const fn saturating_sub(self, rhs: TimeSpan) -> TimeSpan
pub const fn saturating_sub(self, rhs: TimeSpan) -> TimeSpan
Saturating subtraction.
Sourcepub const fn saturating_neg(self) -> TimeSpan
pub const fn saturating_neg(self) -> TimeSpan
Saturating negation.
Trait Implementations§
Source§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 AddAssign<TimeSpan> for DateTime
impl AddAssign<TimeSpan> for DateTime
Source§fn add_assign(&mut self, rhs: TimeSpan)
fn add_assign(&mut self, rhs: TimeSpan)
+= operation. Read moreimpl Copy for TimeSpan
Source§impl Display for TimeSpan
ISO-8601 duration formatting: PnDTnHnMn.fffffffS. Negative values are
prefixed with -. The ZERO value formats as PT0S.
impl Display for TimeSpan
ISO-8601 duration formatting: PnDTnHnMn.fffffffS. Negative values are
prefixed with -. The ZERO value formats as PT0S.
impl Eq for TimeSpan
Source§impl Ord for TimeSpan
impl Ord for TimeSpan
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for TimeSpan
impl PartialOrd for TimeSpan
impl StructuralPartialEq for TimeSpan
Source§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