VISU - PHP Game Framework

Clock
in package

The clock provides utility methods for measuring and working with high resolution time.

Table of Contents

Methods

diff()  : ClockNanoseconds
Returns the time difference between two timestamps in nanoseconds.
diff64()  : int
Returns the difference between two timestamps in nanoseconds as a single 64bit integer.
now()  : ClockNanoseconds
Returns the current time in nanoseconds.
now64()  : int
Returns the current time in nanoseconds as a single 64 bit integer.
sleep()  : void
Sleep for the given amount of nanoseconds.
sleep64()  : void
Sleep for the given amount of nanoseconds using a single 64 bit integer.

Methods

diff64()

Returns the difference between two timestamps in nanoseconds as a single 64bit integer.

public static diff64(ClockNanoseconds $t1, ClockNanoseconds $t2) : int

Note this does only work for timestamps that are less than 2^63 nanoseconds apart.

Parameters
$t1 : ClockNanoseconds

The first timestamp.

$t2 : ClockNanoseconds

The second timestamp.

Return values
int

now64()

Returns the current time in nanoseconds as a single 64 bit integer.

public static now64() : int
Return values
int

sleep64()

Sleep for the given amount of nanoseconds using a single 64 bit integer.

public static sleep64(int $nanoseconds) : void
Parameters
$nanoseconds : int

        
On this page

Search results