phpscript

manual

ClassGo

Time\Duration

Description

Time\Duration constructs a Go duration from a duration string such as "30m", or from an integer nanosecond count.

Time\Duration is a class phpscript declares.

$object = new Time\Duration($value);

Methods

public function abs(): Time\Duration

abs returns the absolute value of d. As a special case, Duration([math.MinInt64]) is converted to Duration([math.MaxInt64]), reducing its magnitude by 1 nanosecond.

The go method Abs.

public function hours(): float

hours returns the duration as a floating point number of hours.

The go method Hours.

public function microseconds(): int

microseconds returns the duration as an integer microsecond count.

The go method Microseconds.

public function milliseconds(): int

milliseconds returns the duration as an integer millisecond count.

The go method Milliseconds.

public function minutes(): float

minutes returns the duration as a floating point number of minutes.

The go method Minutes.

public function nanoseconds(): int

nanoseconds returns the duration as an integer nanosecond count.

The go method Nanoseconds.

public function round(int $m): Time\Duration

round returns the result of rounding d to the nearest multiple of m. The rounding behavior for halfway values is to round away from zero. If the result exceeds the maximum (or minimum) value that can be stored in a [Duration], Round returns the maximum (or minimum) duration. If m <= 0, Round returns d unchanged.

The go method Round.

public function seconds(): float

seconds returns the duration as a floating point number of seconds.

The go method Seconds.

public function truncate(int $m): Time\Duration

truncate returns the result of rounding d toward zero to a multiple of m. If m <= 0, Truncate returns d unchanged.

The go method Truncate.

Static methods

Binding

See also