Clock

Clock

new

A simple clock for keeping track of simulated time.

Parameters:
Name Type Argument Default Description
description.startTime JulianDate <optional>
The start time of the clock.
description.stopTime JulianDate <optional>
The stop time of the clock.
description.currentTime JulianDate <optional>
The current time.
description.multiplier Number <optional>
1.0 Determines how much time advances when tick is called, negative values allow for advancing backwards.
description.clockStep ClockStep <optional>
ClockStep.SYSTEM_CLOCK_MULTIPLIER Determines if calls to tick are frame dependent or system clock dependent.
description.clockRange ClockRange <optional>
ClockRange.UNBOUNDED Determines how the clock should behave when startTime or stopTime is reached.
description.shouldAnimate Boolean <optional>
true Determines if tick should actually advance time.
Throws:
DeveloperError : startTime must come before stopTime.
Example
// Create a clock that loops on Christmas day 2013 and runs in real-time.
var clock = new Clock({
   startTime : JulianDate.fromIso8601("12-25-2013"),
   currentTime : JulianDate.fromIso8601("12-25-2013"),
   stopTime : JulianDate.fromIso8601("12-26-2013"),
   clockRange : ClockRange.LOOP_STOP,
   clockStep : SYSTEM_CLOCK_MULTIPLIER
});
See:
Source:

Members

:ClockRange

Determines how the clock should behave when startTime or stopTime is reached.
Default Value:

:ClockStep

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

:JulianDate

The current time.

: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_MULTIPLIER this value is multiplied by the elapsed system time since the last call to tick.
Default Value:
  • 1.0

An Event that is fired whenever tick.

:Boolean

Determines if tick should actually advance time.
Default Value:
  • true

:JulianDate

The start time of the clock.

:JulianDate

The stop time of the clock.

Methods

Advances the clock from the currentTime based on the current configuration options. tick should be called every frame, regardless of whether animation is taking place or not. To control animation, use the shouldAnimate property.

Returns:
JulianDate The new value of the currentTime property.