Real Time Button - Auto Select

Good Evening,

I was wondering if anyone has had any luck with getting Cesium to automatically select Real Time when loading the page for the first time? I've tried some suggestions from previous discussions but haven't had any success.

If someone has had some luck, would you mind posting what you did to get it to work?



Hey Jacques,

I think all you have to do is initialize the clock with the current time, and make sure the clockStep is set to the system clock type:

var currentTime = Cesium.JulianDate.fromDate(new Date());

var clock = new Cesium.Clock({

startTime : currentTime,

currentTime : currentTime,

clockStep : Cesium.ClockStep.SYSTEM_CLOCK


var viewer = new Cesium.Viewer(‘cesiumContainer’, {

clockViewModel: new Cesium.ClockViewModel(clock)



Here’s a Sandcastle of this code. Let me know if this works for you.

Hi Omar,

Thanks for messaging and providing the above code.

It's giving me a similar issue, Cesium loads and I can see "Real Time" selected. As soon as the .CZML file loads, "Real Time" is no longer selected and we are back to file start times unless manually clicked.

Have you come across this before?

Thanks again!


CZML typically contains the desired clock settings for the client. Most likely your CZML file contains different clock settings which are overriding the SYSTEM_CLOCK setting.

Alternatively, you can create the Viewer with automaticallyTrackDataSourceClocks : false which will then ignore clock settings from data sources like CZML.

Hi Scott,

Thanks for messaging and suggesting the auto track option. I should have spent some time going through the resource available.

The code worked and successfully overrode the CZML Data Source.

Thanks both again for your time.