class Duration is Cool does Real { }

A Duration represents a length of time in atomic seconds, with fractions. Like an Instant, it is epoch-agnostic.

Durations can be subtracted from or added to Instants to yield another, new Instant. Subtracting one Instant from another yields a Duration. A Duration can also result from mathematical operations between two Durations when it makes sense (namely, the addition, subtraction, or modulus of two Durations). It can also be added, subtracted or divided modulo Real numbers.

The type of object returned for other numeric operations is currently unspecified.

Typegraph§

Type relations for Duration
raku-type-graph Duration Duration Cool Cool Duration->Cool Real Real Duration->Real Mu Mu Any Any Any->Mu Cool->Any Numeric Numeric Real->Numeric

Expand chart above