Epoch J2000 and Julian Date

I’m trying to match up Cesium’s time with a planet orbiting library, so I made a sandcastle to help understand Cesium’s time system.

var viewer = new Cesium.Viewer("cesiumContainer");
var someTime = "2000-01-01T11:59:28Z";

var myJuli = Cesium.JulianDate.fromDate(new Date(someTime));
console.log("Julian",myJuli);
//{dayNumber: 2451545, secondsOfDay: 0}

var myGreg = Cesium.JulianDate.toGregorianDate(myJuli);
console.log("Greg",myGreg);
//year: 2000, month: 1, day: 1, hour: 11, minute: 59, second: 28

var gregTOjuli = Cesium.JulianDate.fromGregorianDate(myGreg);
console.log("gregTOjuli",gregTOjuli);
//{dayNumber: 2451545, secondsOfDay: 0}

en.wikipedia.org/wiki/Epoch_(astronomy)#Julian_Dates_and_J2000
According to the website, it would appear that the conversion occurring is between
International Atomic Time and Julian time, not between Gregorian time and Julian, because 11:59:28 is matching up with Julian 0 secondsOfDay. This is fine if this is the case, but if it is perhaps the methods should be renamed? Granted over many decades 32 seconds doesn’t amount to much, even for planetary position calculations, so I suppose it’s no big deal, just thought I’d share out of curiosity’s sake.

Hello @Hyper_Sonic,

I am surely not an expert, but the docs specify that the JulianDate is always stored in the International Atomic Time system, even thourgh the default constructor timeStandard is UTC. This might explain why JulianDate console logs have the deviation?

Documentation from JulianDate
" In order to be safe for arithmetic and represent leap seconds, the date is always stored in the International Atomic Time standard TimeStandard.TAI ."

Thanks, I see this now
github.com/CesiumGS/cesium/blob/1.71/Source/Core/TimeStandard.js#L8

Cesium.TimeStandard
Defaults to {UTC: 0, TAI: 1}

I suppose this time standard is how Cesium got its name?
en.wikipedia.org/wiki/Caesium_standard

github.com/CesiumGS/cesium/blob/1.71/Source/Core/JulianDate.js#L232

  if (timeStandard === TimeStandard.UTC) {
    convertUtcToTai(this);

github.com/CesiumGS/cesium/blob/1.71/Source/Core/JulianDate.js#L299

convertUtcToTai(result);

It would appear that even set to UTC that it would be converted to TAI.

github.com/CesiumGS/cesium/blob/1.71/Source/Core/JulianDate.js#L1202
Lots of leap seconds here. I suppose this extreme time accuracy helps with the precision of things like the Sun and the Moon positions.

1 Like