Hello, I am brand-new to Orekit and am trying to convert among Calendar, GPS, JDD, MJD and ISO 8601 formats, and I’m unsure of the canonical way to do this. In the case of GPS, I see on the forum that it’s suggested to use the GNSSDate class. So I did the following (using the Python wrapper, though I don’t think this makes a difference):
utcDateFrom8601 = AbsoluteDate(“2023-11-17T10:01:42.200Z”, TimeScalesFactory.getUTC())
gnssDateFromUTC = GNSSDate(utcDateFrom8601, SatelliteSystem.GPS)
print(gnssDateFromUTC.getDate()) → 2023-11-17T10:01:42.200Z
This appears to be the internal AbsoluteDate object. Had I used TimeScalesFactory.getGPS() instead, it would be 18 leap seconds less. My understanding seemed OK to this point.
Then I get the week number and time of week:
print(gnssDateFromUTC.getWeekNumber()) → 2288
print(gnssDateFromUTC.getMilliInWeek()) → 468120200.0
and construct a new GNSSDate object using this information:
gnssDateFromWeekMilli = GNSSDate(2288, 468120200.0, SatelliteSystem.GPS)
However, the AbsoluteDate value of GNSSDate built from the UTC doesn’t exactly equal that of the GNSSDate built from its week and milli values:
print(gnssDateFromWeekMilli.getDate()) → 2023-11-17T10:01:42.20000000001164Z
Now, a difference of .00000000001164, being a fraction of a nanosecond, doesn’t seem meaningful between GPS and UTC according to any resolution guarantees, but .isEqualTo is false, and in general I suspect I must not be going about conversions the right way, or perhaps it’s understood that precision needs to be limited in some cases, etc. If someone can help me understand this or point me to canonical example code for handling such conversions accurately, it would be greatly appreciated.