# Conversion of seconds since J2000 epoch Terrestrial Time to UTC time

A recent question on Space Exploration mentioned that Planet Labs provides public ephemerides for their satellites here. I believe this provides a very valuable resource for testing different orbital propagators.

However, in order to perform such tests, it is key to know to exactly what time the provided ephemerides correspond. The ephemerides by Planet Labs give the epoch in "seconds since J2000 epoch Terrestrial Time". Several of us at Space Exploration are interested in converting accurately such epoch to UTC time (i.e., with at least millisecond accuracy).

Therefore, I was wondering if there is any specific algorithm that should be applied in order to perform such conversion? From my understanding, it would be enough to do the following:

1. Get the J2000 epoch Terrestrial Time in UTC, which seems to be January 1st, 2000 at 11:58:55.816 (see here)
2. Calculate a date and time using such epoch (which is in UTC) and the provided seconds since J2000 epoch Terrestrial Time (since we are now going from seconds since epoch to a date and time, leap seconds need to be taken into account)

Would this be enough to perform an accurate conversion? Or am I missing some additional steps here?

• FWIW, Lick Observatory astronomer Steve Allen has a lot of info about leap seconds and time scales on his site. Dec 6, 2021 at 16:10
• Here's some Python code on Github that shows how to parse leap-seconds.list, with a live version linked in the comment below the program source code. Dec 6, 2021 at 17:05

Which Terrestrial Time (TT)? The International Bureau of Weights and Measures (BIPM; the acronym is French) releases updates to the relationship between TT and International Atomic Time (TAI; the acronym once again is in French)on an annual basis. Note well: These updates change both the future and past relationship between TT and TAI.

Fortunately, except for astronomers doing microarcsecond astronomy, these annual corrections are tiny nuances that can be ignored. They're in the range of a few tens of nanoseconds. To the microsecond level, simply use the fact that TT is constantly ahead of TAI by 32.184 seconds: $$T_{\text{TT}} = T_{\text{TAI}} + 32.184\,\text{s}\tag{1}$$

That's TAI, which is fairly simple. GPS time is also fairly simple because it's a fixed offset from TAI. The relation between TAI and Coordinated Universal Time (UTC; the acronym is what it is; it is neither French nor English) is not so simple. You'll have to account for leap seconds. There is no equation for the relation between TAI and UTC. You'll need a leap second table: \begin{align} T_{\text{UTC}} &= T_{\text{TAI}} - \operatorname{leap}_{\text{TAI}}(T_{\text{TAI}})\quad \text{or} \\ T_{\text{TAI}} &= T_{\text{UTC}} + \operatorname{leap}_{\text{UTC}}(T_{\text{UTC}}) \tag{2} \end{align}

Combining equations (1) and (2) yields $$T_{\text{TT}} = T_{\text{UTC}} + \operatorname{leap}_{\text{UTC}}(T_{\text{UTC}}) + 32.184\,\text{s}\tag{3}$$

To build your leap second table $$\operatorname{leap}_{\text{UTC}}(T_{\text{UTC}})$$ in a pedantically correct manner means eschewing the idea that every UTC minute contains exactly 60 UTC seconds. For example, the UTC time half a second before 00:00 1 Jan 2017 UTC was 23:59:60.5 31 December 2016 UTC. Windows, Linux, Android, iOS, OS X: all of them do it wrong. Those operating systems assume every minute comprises exactly 60 seconds, and fudge things for leap second boundaries. They'll all have a complete fit if current trends continue and the first ever negative leap second is added five or six years from now.

• The IETF provide a leap seconds table in a format that's relatively easy to parse. ietf.org/timezones/data/leap-seconds.list However, it uses seconds since 1900-Jan 1 00:00:00 for the epoch of its timestamps. Also, the SHA-1 hash line at the end of the file is broken into 5 groups of hex numbers without leading zeroes, which is slightly annoying. Dec 6, 2021 at 15:55
• Thanks a lot for this! I am currently using CelesTrak Earth Orientation Parameters table, which conveniently provides a column with leap seconds. I am still a bit confused about the meaning of Planet Lab's "seconds since J2000 epoch Terrestrial Time". I guess the most reasonable thing would be to think they mean TT seconds since the TT J2000 epoch, but can it be completely ruled out that they actually mean UTC seconds since the TT J2000 epoch? I guess the easiest might just be email Planet Labs to ask about it
– Rafa
Dec 7, 2021 at 2:48
• For future reference, I received confirmation that the epoch for Planet Labs state vectors does not include leap seconds
– Rafa
Dec 7, 2021 at 4:04
• @Rafa With the introduction of the concept of leap seconds in 1972, UTC seconds and TAI seconds are by definition identically equal. For all practical purposes (except microarcsecond astronomy), TT seconds and TAI seconds are also identically equal. This means that you can consider TT seconds, TAI seconds, and UTC seconds to be one and the same thing. Dec 7, 2021 at 10:20