Struct hourglass::Deltatime [] [src]

pub struct Deltatime(_);

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 = hourglass::Timezone::utc();
let t = utc.datetime(2015, 6, 30, 0, 0, 0, 0).unwrap();

let add_86400_secs = t + hourglass::Deltatime::seconds(86400);

assert_eq!(add_86400_secs.date(), (2015, 6, 30));
assert_eq!(add_86400_secs.time(), (23, 59, 60, 0));

Methods

impl Deltatime
[src]

Create a delta of n nanoseconds. Possible leap seconds are accounted for.

Create a delta of n microseconds. Possible leap seconds are accounted for.

Create a delta of n milliseconds. Possible leap seconds are accounted for.

Create a delta of n seconds. Possible leap seconds are accounted for.

Create a delta of n minutes. Possible leap seconds are accounted for.

Create a delta of n hours. Possible leap seconds are accounted for.

Create a delta of n days. The time part of the shifted Datetime is not affected. This is a logical day, therefore, leap seconds are ignored.

Returns the total number of nanoseconds contained in this delta. If the delta is created from Deltatime::days, the number of nanoseconds in a day is assumed to be 86400e9.

Returns the total number of microseconds contained in this delta. If the delta is created from Deltatime::days, the number of microseconds in a day is assumed to be 86400e6.

Returns the total number of milliseconds contained in this delta. If the delta is created from Deltatime::days, the number of milliseconds in a day is assumed to be 86400e3.

Returns the total number of seconds contained in this delta. If the delta is created from Deltatime::days, the number of seconds in a day is assumed to be 86400.

Returns the total number of minutes contained in this delta.

Returns the total number of hours contained in this delta.

Returns the total number of days contained in this delta.

Trait Implementations

impl Clone for Deltatime
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Deltatime
[src]

impl Debug for Deltatime
[src]

Formats the value using the given formatter.

impl PartialEq<Deltatime> for Deltatime
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Deltatime
[src]

impl PartialOrd<Deltatime> for Deltatime
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for Deltatime
[src]

This method returns an Ordering between self and other. Read more

impl Neg for Deltatime
[src]

The resulting type after applying the - operator

The method for the unary - operator