Clock

Clock

new Clock

A simple clock for keeping track of simulated time.

Parameters:
Name Type Argument Description
template Object <optional>
The template object containing the properties to be set on the clock.
Throws:
DeveloperError : startTime must come before stopTime.
Example
//Create a clock that loops on Christmas day 2012 and runs
//in real-time.  currentTime will default to startTime.
var clock = new Clock({
   startTime : JulianDate.fromIso8601("12-25-2012");
   stopTime : JulianDate.fromIso8601("12-26-2012");
   clockRange : ClockRange.LOOP;
});
See:

Members

clockRange :ClockRange

Determines how tick should behave when startTime or stopTime is reached.

clockStep :ClockStep

Determines if calls to tick are frame dependent or system clock dependent.

currentTime :JulianDate

The current time.

multiplier :Number

Determines how much time advances when tick is called, negative values allow for advancing backwards. If clockStep is set to ClockStep.TICK_DEPENDENT this is the number of seconds to advance. If clockStep is set to ClockStep.SYSTEM_CLOCK_DEPENDENT this value is multiplied by the elapsed system time since the last call to tick.

startTime :JulianDate

The start time of the clock.

stopTime :JulianDate

The stop time of the clock.

Methods

reverseTick

Advances the clock in the opposite direction of the current multiplier. If multiplier is positive this will advance the clock backwards one tick. If multiplier is negative this will advance the clock forward one tick.

Returns:
JulianDate The new value of Clock.currentTime

tick

Advances the clock from the currentTime based on the current configuration options.

Parameters:
Name Type Argument Description
secondsToTick Number <optional>
optional parameter to force the clock to tick the provided number of seconds, regardless of the value of clockStep and multiplier.
Returns:
JulianDate The new value of the currentTime property.