pub struct RosettaDelta {
pub total_seconds: i64,
pub years: i64,
pub months: i64,
pub days: i64,
pub hours: i64,
pub minutes: i64,
pub seconds: i64,
}Expand description
Represents the difference between two date-times, broken down into human-readable components.
Fields§
§total_seconds: i64Positive if end > start.
years: i64Approximate years component.
months: i64Approximate months component (remainder after years).
days: i64Days component (remainder after months).
hours: i64Hours component.
minutes: i64Minutes component.
seconds: i64Seconds component.
Implementations§
Source§impl RosettaDelta
impl RosettaDelta
Sourcepub fn between(start: &RosettaDateTime, end: &RosettaDateTime) -> Self
pub fn between(start: &RosettaDateTime, end: &RosettaDateTime) -> Self
Compute the delta from start to end.
The breakdown into years/months is approximate (assumes 365-day years and 30-day months). Total seconds is exact.
Sourcepub fn abs_seconds(&self) -> u64
pub fn abs_seconds(&self) -> u64
Total absolute seconds.
Sourcepub fn is_positive(&self) -> bool
pub fn is_positive(&self) -> bool
Is the delta representing a positive (future) direction?
Sourcepub fn total_days(&self) -> i64
pub fn total_days(&self) -> i64
Total complete days (truncated).
Sourcepub fn total_hours(&self) -> i64
pub fn total_hours(&self) -> i64
Total complete hours.
Sourcepub fn total_minutes(&self) -> i64
pub fn total_minutes(&self) -> i64
Total complete minutes.
Trait Implementations§
Source§impl Clone for RosettaDelta
impl Clone for RosettaDelta
Source§fn clone(&self) -> RosettaDelta
fn clone(&self) -> RosettaDelta
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RosettaDelta
impl Debug for RosettaDelta
Source§impl Display for RosettaDelta
impl Display for RosettaDelta
Source§impl PartialEq for RosettaDelta
impl PartialEq for RosettaDelta
Source§fn eq(&self, other: &RosettaDelta) -> bool
fn eq(&self, other: &RosettaDelta) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for RosettaDelta
impl StructuralPartialEq for RosettaDelta
Auto Trait Implementations§
impl Freeze for RosettaDelta
impl RefUnwindSafe for RosettaDelta
impl Send for RosettaDelta
impl Sync for RosettaDelta
impl Unpin for RosettaDelta
impl UnsafeUnpin for RosettaDelta
impl UnwindSafe for RosettaDelta
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more