Duration is the time which has passed between two timepoints.
Methods
Clones the Duration and returns a new independet value.
Example
let dur = new;
let dur_cloned = dur.clone;
dur += from_days;
assert_ne!;
Create a new Duartion from amount of days.
Example
let duration = from_days;
assert_eq!;
Create a new Duartion from amount of hours.
Example
let duration = from_hours;
assert_eq!;
Create a new Duartion from amount of weeks.
Example
let duration = from_weeks;
assert_eq!;
Create a new Duartion from amount of minutes.
Example
let duration = from_minutes;
assert_eq!;
Create a new Duartion from amount of seconds.
Example
let duration = from_seconds;
assert_eq!;
Create a new Duartion from amount of milliseconds.
Example
let duration = from_milliseconds;
assert_eq!;
Get the number of whole days from the duration.
Example
let duration = from_days;
assert_eq!;
Get the whole_hours of whole hours from the duration.
Example
let duration = from_hours;
assert_eq!;
Get the whole_hours of whole weeks from the duration.
Example
let duration = from_weeks;
assert_eq!;
Get the whole_hours of whole minutes from the duration.
Example
let duration = from_minutes;
assert_eq!;
Get the whole_hours of whole seconds from the duration.
Example
let duration = from_seconds;
assert_eq!;
Get the whole_hours of whole milliseconds from the duration.
Example
let duration = from_milliseconds;
assert_eq!;
Protocols
let output = value + b
Add two durations together.
Example add duration
let one = from_days;
assert_eq!;
Example add DateTime
let dt = new_epoch;
let one = from_days;
let res = dt + one;
assert_eq!;
value += b
The add assign operation for Duration.
Example
let duration = from_days;
duration += from_days;
assert_eq!;
let output = value - b
The sub operation for Duration.
Example
let two = from_days;
let one = from_days;
assert_eq!;
value -= b
The sub assign operation for Duration.
Example
let duration = from_days;
duration -= from_days;
assert_eq!;