Object - thyme : Duration
Represents a mutable chunk of time without particular start or end.
Methods
Clone the current status of a
Duration
, since it's mutable.
Example:
Duration d = someDuration.clone();
Get the current value of a single unit type.
Example:
int|error i = someDuration.get("hour");
Get total value of duration as an
int
.
Example:
int|error i = someDuration.totalAsInt("minute");
Get total value of duration as a
float
.
Example:
float|error f = someDuration.totalAsFloat("minute");
Clone the current status of a
Duration
, since it's mutable.
Example:
Duration d = someDuration.clone();
-
Return Type
(Duration) Duration
Get the current value of a single unit type.
Example:
int|error i = someDuration.get("hour");
Parameters
- unit string
-
A valid unit from
DURATION_UNIT_OPTIONS
-
Return Type
(int | error) An
int
, or anerror
if unknown unit
Get total value of duration as an
int
.
Example:
int|error i = someDuration.totalAsInt("minute");
Parameters
- unit string
-
A valid unit from
DURATION_UNIT_OPTIONS
-
Return Type
(int | error) An
int
, or anerror
if unknown unit or conversions inside fail
Get total value of duration as a
float
.
Example:
float|error f = someDuration.totalAsFloat("minute");
Parameters
- unit string
-
A valid unit from
DURATION_UNIT_OPTIONS
-
Return Type
(float | error) A
float
, or anerror
if unknown unit or conversions inside fail