There are five timescales of interest:
- TAI - International Atomic Time, as maintained by a network of atomic clocks
- TT - Terrestrial Time. Used for astronomical observations. It is designed to be free of the irregularities of the rotation of the earth. It is based on TAI, and for historical reasons has the following relationship TT = TAI + 32.184 seconds
- UT1 - Universal Time. This is the timescale that essentially represents the rotation of the earth, and therefore is subject to the fluctuations that occur in that rotation. (Also called simply UT)
- UTC - Coordinated Universal Time. This is the time we all use. It is based on TAI, but occasionally a leap second is inserted (or, in theory, removed) to keep UTC within 0.9 seconds of UT1.
- local civil time - This is UTC + (local timezone offset)
What this means for astronomical observations is that we need to obtain the time in the UTC timescale (either directly, or from the local civil time) and calculate TT and UT1 from it. TT is needed to calculate the celestial positions of objects in the sky, and UT1 is needed for converting that celestial coordinate into a direction as seen from a site on the surface of the earth, as it rotates.
We need three pieces of information.
- ΔTAI = TT - TAI = 32.184 s (a fixed value, as described above)
- ΔAT = TAI - UTC. This is the number of leap seconds that have been added in the past. This figure is available from the International Earth Rotation Service (IERS) at the Observatoire de Paris, via its regular Bulletin C, available at https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat When accessed in August 2019, this value was 37 seconds. (Note that Bulletin C expresses the relation as UTC - TAI, so it said -37 s.)
- ΔUT = UT1 - UTC. This is available from the IERS, at the US Naval Observatory website, in its Bulletin A. https://maia.usno.navy.mil/ser7/ser7.dat or from https://www.iers.org/IERS/EN/Publications/Bulletins/bulletins.html It also gives the leap seconds, this time in the form TAI - UTC. The value of deltaUT varies from day to day, but because its value is always within the range -0.9..+0.9, you have four choices as to what to do about it.
- A. Ignore it altogether, and assume it is equal to zero. This will have no effect on the calculation of celestial coordinates, but could introduce an error of up to 0.00375° in the direction from the ground, if you are unlucky. For most purposes, this is good enough. Initialise your code with the function sky_initTimeSimple(), or call sky_initTime() with deltaUT_s set to 0.0
- B. Check Bulletin A every few months, and call sky_initTime() with deltaUT_s set to the value of DUT1 given near the top of the file, described as "transmitted with time signals". This will give a better approximation.
C. Check Bulletin A every few months, and find the PREDICTIONS section, and look for a line that looks like the following:
UT1-UTC = -0.1733 - 0.00056 (MJD - 58725) - (UT2-UT1)
^^^^^^^ ^^^^^^^^^ ^^^^^
CoeffC11 CoeffC12 MJDbase
Take the three numbers and pass them to the function sky_initTimeDetailed() which will use this formula to predict the value. This method is good enough be used by large astronomical telescopes.
- D. Check Bulletin A every week, and use the values in the table for each day. Almost nobody should need to do this.
There are two more such quantities, but we can calculate them from the above
- ΔT = TT - UT1. This is also obtainable from ΔT = ΔTAI + ΔAT - ΔUT.
- ΔTT = TT - UTC. This is also obtainable from ΔTT = ΔTAI + ΔAT.
Once you have set the above with sky_initTime(), sky_initTimeSimple() or sky_initTimeDetailed(), then calling sky_updateTimes() will convert a time in the UTC timescale to various times in the other timescales, ready for use.
Pursuit of really accurate UT1 (as outlined in 3C and 3D above) really only makes sense if your system clock is accurately synchronised to UTC.
But wait! There's more! If you want really accurate coordinates, you have to take into account another variation in the earth's rotation. The polar axis itself moves around a tiny amount. This is called polar motion. If this matters to you, the values of polar motion can be obtained from the same Bulletin A described above. But for normal purposes, you can just enter zero for these parameters (or just not call sky_setPolarMotion() at all).