diff --git a/src/api/time/TimeAPI.js b/src/api/time/TimeAPI.js index aea887e756..8d73a99722 100644 --- a/src/api/time/TimeAPI.js +++ b/src/api/time/TimeAPI.js @@ -366,11 +366,6 @@ define(['EventEmitter'], function (EventEmitter) { this.activeClock = clock; - if (this.activeClock !== undefined) { - this.offsets = offsets; - this.activeClock.on("tick", this.tick); - } - /** * The active clock has changed. Clock can be unset by calling {@link stopClock} * @event clock @@ -380,6 +375,11 @@ define(['EventEmitter'], function (EventEmitter) { */ this.emit("clock", this.activeClock); + if (this.activeClock !== undefined) { + this.clockOffsets(offsets); + this.activeClock.on("tick", this.tick); + } + } else if (arguments.length === 1) { throw "When setting the clock, clock offsets must also be provided"; }