Class TimeValue
Time duration representation and conversion.
Methods summary
public
__construct( integer|float $value, integer $unit )
Construct a new amount of time representation.
public
compareTo( WonderPush\Util\TimeValue $other )
: integer
Compares the object to another time value.
public
__toString( void )
: string
Return a short human readable representation of this object, suitable for further parsing.
public static
parse( string|integer|float|WonderPush\Util\TimeValue $value, integer $defaultUnit = TimeUnit::MILLISECONDS )
: WonderPush\Util\TimeValue|null
Parses a number with an optional unit into a time value.
public static
Nanoseconds( integer|float $value )
: WonderPush\Util\TimeValue
Returns a time value with the given amount of nanoseconds.
public static
Microseconds( integer|float $value )
: WonderPush\Util\TimeValue
Returns a time value with the given amount of microseconds.
public static
Milliseconds( integer|float $value )
: WonderPush\Util\TimeValue
Returns a time value with the given amount of milliseconds.
public static
Seconds( integer|float $value )
: WonderPush\Util\TimeValue
Returns a time value with the given amount of seconds.
public static
Minutes( integer|float $value )
: WonderPush\Util\TimeValue
Returns a time value with the given amount of minutes.
public static
Hours( integer|float $value )
: WonderPush\Util\TimeValue
Returns a time value with the given amount of hours.
public static
Days( integer|float $value )
: WonderPush\Util\TimeValue
Returns a time value with the given amount of days.
public static
Weeks( integer|float $value )
: WonderPush\Util\TimeValue
Returns a time value with the given amount of weeks.
public
convert( integer $toUnit )
: WonderPush\Util\TimeValue
Converts the time value into another time value using the desired unit.
public
to( integer $toUnit )
: integer|float
Returns the time value amount expressed in the desired unit.
public
toNanoseconds( void )
: integer|float
Returns the time value amount expressed in nanoseconds.
public
toMicroseconds( void )
: integer|float
Returns the time value amount expressed in microseconds.
public
toMilliseconds( void )
: integer|float
Returns the time value amount expressed in milliseconds.