# Clock

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

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 `Clock#tick` is called, negative values allow for advancing backwards.决定时间流速。可以倒流。
`clockStep` | ClockStep | `ClockStep.SYSTEM_CLOCK_MULTIPLIER` | optional Determines if calls to `Clock#tick` are frame dependent or system clock dependent.是以每一帧刷新时间还是遵照系统时间
`clockRange` | ClockRange | `ClockRange.UNBOUNDED` | optional Determines how the clock should behave when `Clock#startTime` or `Clock#stopTime` is reached.当到达开始时间和结束时间是会如何表现。UNBOUNDED：一直往下走；CLAMPED：停止；LOOP_STOP：循环；
`canAnimate` | Boolean | `true` | optional Indicates whether `Clock#tick` can advance time. This could be false if data is being buffered, for example. The clock will only tick when both `Clock#canAnimate` and `Clock#shouldAnimate` are true.是都运行时间
`shouldAnimate` | Boolean | `false` | optional Indicates whether `Clock#tick` should attempt to advance time. The clock will only tick when both `Clock#canAnimate` and `Clock#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 115

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

Default Value: `true`

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

Determines how the clock should behave when `Clock#startTime` or `Clock#stopTime` is reached.

Default Value: ``ClockRange.UNBOUNDED``

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

Determines if calls to `Clock#tick` are frame dependent or system clock dependent. Changing this property to `ClockStep.SYSTEM_CLOCK` will set `Clock#multiplier` to 1.0, `Clock#shouldAnimate` to true, and `Clock#currentTime` to the current system clock time.

Default Value: ``ClockStep.SYSTEM_CLOCK_MULTIPLIER``

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

The current time. Changing this property will change `Clock#clockStep` from `ClockStep.SYSTEM_CLOCK` to `ClockStep.SYSTEM_CLOCK_MULTIPLIER`.

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

Gets or sets how much time advances when `Clock#tick` is called. Negative values allow for advancing backwards. If `Clock#clockStep` is set to `ClockStep.TICK_DEPENDENT`, this is the number of seconds to advance. If `Clock#clockStep` is set to `ClockStep.SYSTEM_CLOCK_MULTIPLIER`, this value is multiplied by the elapsed system time since the last call to `Clock#tick`. Changing this property will change `Clock#clockStep` from `ClockStep.SYSTEM_CLOCK` to `ClockStep.SYSTEM_CLOCK_MULTIPLIER`.

Default Value: `1.0`

#### onStop : Event
Core/Clock.js 126

An `Event` that is fired whenever `Clock#stopTime` is reached.

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

An `Event` that is fired whenever `Clock#tick` is called.

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

Indicates whether `Clock#tick` should attempt to advance time. The clock will only advance time when both `Clock#canAnimate` and `Clock#shouldAnimate` are true. Changing this property will change `Clock#clockStep` from `ClockStep.SYSTEM_CLOCK` to `ClockStep.SYSTEM_CLOCK_MULTIPLIER`.

Default Value: `false`

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

The start time of the clock.

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

The stop time of the clock.

### Methods

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

Advances the clock from the current time 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 `Clock#shouldAnimate` property.

##### Returns:

The new value of the `Clock#currentTime` property.