GPS to UTC time conversion

Hello,

I was wandering if in Orekit there is a method to easily convert a GPS time (expressed as GPS week + seconds in the week) to UTC date/time. I guess I shall use the AbsoluteDate class and construct it specifying a GPS time and the GPS time scale. But how can I do it?

Would anybody be so kind to show me, with an example, how to convert a date in GPS time to a date in UTC?

For instance, how do you convert the following GPS time:

  • 2235 GPS week
  • 337003 GPS seconds of week

to its equivalent UTC time 2022-11-09T21:36:25? (conversion performed on GPS Time Calculator)

Thank you very much.
Kind Regards,
Alfredo

Hi @acapobianchi

You can use the GNSSDate class. You can initialize the GNSSDate using the week number, the number of milliseconds in the week, and the satellite system (e.g. SatelliteSystem.GPS). Once initialized, you have a method getDate() which returns an AbsoluteDate.

final GNSSDate gpsDate = new GNSSDate(2235, 1000.0 * 337003.0, SatelliteSystem.GPS);
final AbsoluteDate epoch = gpsDate.getDate();

For examples, you can also look at the test class of GNSSDate.

Best regards,
Bryan

1 Like