# Clock

#### new Cesium.Clock(options)
Core/Clock.js 55

  A simple clock for keeping track of simulated time.

  Name | Type | Description
  --- | --- | ---
  `options` | Object | optional Object with the following properties:
  Name | Type | Default | Description
  --- | --- | --- | ---
  `startTime` | JulianDate |  | optional The start time of the clock.
  `stopTime` | JulianDate |  | optional The stop time of the clock.
  `currentTime` | JulianDate |  | optional The current time.
  `multiplier` | Number | `1.0` | optional Determines how much time advances when tick is called, negative values allow for advancing backwards.
  `clockStep` | ClockStep | `ClockStep.SYSTEM_CLOCK_MULTIPLIER` | optional Determines if calls to `tick` are frame dependent or system clock dependent.
  `clockRange` | ClockRange | `ClockRange.UNBOUNDED` | optional Determines how the clock should behave when `startTime` or `stopTime` is reached.
  `canAnimate` | Boolean | `true` | optional Indicates whether tick can advance time. This could be false if data is being buffered, for example. The clock will only tick when both `canAnimate` and `shouldAnimate` are true.
  `shouldAnimate` | Boolean | `true` | optional Indicates whether tick should attempt to advance time. The clock will only tick when both `canAnimate` and `shouldAnimate` are true.

  ##### 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 Cesium.Clock({
         startTime : Cesium.JulianDate.fromIso8601("2013-12-25"),
         currentTime : Cesium.JulianDate.fromIso8601("2013-12-25"),
         stopTime : Cesium.JulianDate.fromIso8601("2013-12-26"),
         clockRange : Cesium.ClockRange.LOOP_STOP,
         clockStep : Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER
      });

  ##### See:

  - ClockStep
  - ClockRange
  - JulianDate

### Members

#### canAnimate : Boolean
Core/Clock.js 142

  Indicates whether tick can advance time. This could be false if data is being buffered, for example. The clock will only tick when both `canAnimate` and `shouldAnimate` are true.
  Default Value: `true`

#### clockRange : ClockRange
Core/Clock.js 134

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

#### clockStep : ClockStep
Core/Clock.js 127

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

#### currentTime : JulianDate
Core/Clock.js 110

  The current time.

#### multiplier : Number
Core/Clock.js 120

  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`

#### onTick : Event
Core/Clock.js 156

  An `Event` that is fired whenever `tick`.

#### shouldAnimate : Boolean
Core/Clock.js 150

  Indicates whether tick should attempt to advance time. The clock will only tick when both `canAnimate` and `shouldAnimate` are true.
  Default Value: `true`

#### startTime : JulianDate
Core/Clock.js 98

  The start time of the clock.

#### stopTime : JulianDate
Core/Clock.js 104

  The stop time of the clock.

### Methods

#### tick() → JulianDate
Core/Clock.js 168

  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:

  The new value of the `currentTime` property.