Clock

util Clock

Clock is a MonotonicClock that also offers the possibility of being reset.

Constructor

new Clock()

Source:

Extends

Methods

add(deltaTimeopt)

Source:

Add more time to the clock's 'start' time (t0).

Note: by adding time to t0, the current time is pushed forward (it becomes smaller). As a consequence, getTime() may return a negative number.

Parameters:
Name Type Attributes Description
deltaTime number <optional>

the time to be added to the clock's start time (t0)

getLastResetTime() → {number}

Source:
Overrides:

Get the current offset being applied to the high resolution timebase used by this Clock.

Returns:

the offset (in seconds)

Type
number

getTime() → {number}

Source:
Overrides:

Get the current time on this clock.

Returns:

the current time (in seconds)

Type
number

reset(newTimeopt)

Source:

Reset the time on the clock.

Parameters:
Name Type Attributes Default Description
newTime number <optional>
0

the new time on the clock.