Class: Toybox.Time.Duration
 Inherits:

Toybox.Lang.Object
Overview
A Duration is an immutable period of time.
Duration objects are closely related to Moment objects, and are frequently used together for time calculations. While a Moment represents a single point in time, a Duration represents a span of time such as seven days.
Duration objects are stored as a the number of seconds that compose the span of time the Duration represents.
Instance Method Summary collapse

add(time as Time.Moment or Time.Duration) as Time.Moment or Time.Duration
Add a Moment or another Duration to a Duration.

compare(duration as Time.Duration) as Lang.Number
Determine if a Duration is shorter or longer than another Duration.

divide(value as Lang.Number or Lang.Float) as Time.Duration
Divide a Duration by a value.

greaterThan(duration as Time.Duration) as Lang.Boolean
Determine if a Duration is longer than another Duration.

initialize(value as Lang.Number) Time.Duration
Constructor.

lessThan(duration as Time.Duration) as Lang.Boolean
Determine if a Duration is shorter than another Duration.

multiply(value as Lang.Number or Lang.Float) as Time.Duration
Multiply a Duration by a value.

subtract(duration as Time.Duration) as Time.Duration
Get the absolute difference between two Duration objects.

value() as Lang.Number
Get the value of a Duration.
Instance Method Details
add(time as Time.Moment or Time.Duration) as Time.Moment or Time.Duration
Add a Moment or another Duration to a Duration.
When adding a Moment to a Duration, this method functions the same as the Moment.add() method.
compare(duration as Time.Duration) as Lang.Number
Determine if a Duration is shorter or longer than another Duration.
This computes a Number representing the difference between the two Duration objects in seconds. The subtract() method can also be used to get the absolute difference between two Duration objects.
divide(value as Lang.Number or Lang.Float) as Time.Duration
Divide a Duration by a value.
greaterThan(duration as Time.Duration) as Lang.Boolean
Determine if a Duration is longer than another Duration.
initialize(value as Lang.Number) Time.Duration
Constructor
lessThan(duration as Time.Duration) as Lang.Boolean
Determine if a Duration is shorter than another Duration.
multiply(value as Lang.Number or Lang.Float) as Time.Duration
Multiply a Duration by a value.
subtract(duration as Time.Duration) as Time.Duration
Get the absolute difference between two Duration objects.
The computed Duration is always a positive value. The compare() method can also be used to get the difference between two Duration objects.
value() as Lang.Number
Get the value of a Duration.