pub struct Deltatime(/* private fields */);Expand description
A delta of time used in Datetime arithmetic.
This represents a duration in time and can be used to shift Datetime
by a specified amount of time or as a result of comparing two
Datetime. Different types of Deltatime can be created and
each of those types affects Datetime differently. For example,
Deltatime::seconds(86400) is different from Deltatime::days(1)
because a Deltatime is dependant of the Datetime it applies to.
§Example
let utc = tzdata::Timezone::utc();
let t = utc.datetime(2015, 6, 30, 0, 0, 0, 0);
let add_86400_secs = t + tzdata::Deltatime::seconds(86400);
assert_eq!(add_86400_secs.date(), (2015, 6, 30));
assert_eq!(add_86400_secs.time(), (23, 59, 60, 0));Implementations§
Source§impl Deltatime
impl Deltatime
Sourcepub fn nanoseconds(n: i64) -> Self
pub fn nanoseconds(n: i64) -> Self
Create a delta of n nanoseconds. Possible leap seconds are
accounted for.
Sourcepub fn microseconds(n: i64) -> Self
pub fn microseconds(n: i64) -> Self
Create a delta of n microseconds. Possible leap seconds are
accounted for.
Sourcepub fn milliseconds(n: i64) -> Self
pub fn milliseconds(n: i64) -> Self
Create a delta of n milliseconds. Possible leap seconds are
accounted for.
Sourcepub fn seconds(n: i64) -> Self
pub fn seconds(n: i64) -> Self
Create a delta of n seconds. Possible leap seconds are
accounted for.
Sourcepub fn minutes(n: i64) -> Self
pub fn minutes(n: i64) -> Self
Create a delta of n minutes. Possible leap seconds are
accounted for.