# Slovenian Nautical Almanac - Part 4 - UTC, TDB, UT1...

07.03.2016
Aljoša Kocen

The aim of this post was to provide an explanation on different time scales and time formats used in astronomic calculations. But in the virtual quest I noticed, that (un)fortunatelly, it had been done before. J. Richard Fisher of National Radio Astronomy Observatory (NRAO) has provided a beautiful and really elegant explanation of all the terms. Please, do follow his words on the subject on his homepage.

Dates and times in nautical Almanac are listed as Universal Coordinated Time. (UTC). The Ephemerides use Terrestial Time TT. Difference between TT and UTC is Called DeltaT.  Long-term predictions of DeltaT are impossible. Guys at JPL have, however compiled a set of polynomial expressions to evaluate DeltaT by curve fitting them to measured data.

as the only input to the polynomials is essentially Date, I will program yet another Extension Method, and add DeltaT estimator to `DateTime` object:

```    ''' <summary>
''' Calculates the difference between UT and TT, based on the UT DateTime Object
''' </summary>
''' <param name="InputDate">Input DateTime</param>
''' <returns>DeltaT in Seconds</returns>
<Extension()>
Public Function DeltaT(ByVal InputDate As DateTime) As Decimal
Dim Year As Integer = InputDate.Year
Dim Month As Integer = InputDate.Month

'Result
Dim DeltaT As Decimal

'Auxiliary polynomial argument
Dim t As Decimal

'Calculate Decimal Year
Dim DecimalYear As Decimal = Year + (Month - 0.5) / 12

'DeltaT is calculated for the range 1800 - 2050' Can be extended with full set if required
If DecimalYear >= 1800 And DecimalYear < 1860 Then
t = DecimalYear - 1800
DeltaT = 3.72 - 0.332447 * t +
0.0068612 * t ^ 2 +
0.0041116 * t ^ 3 -
0.00037436 * t ^ 4 +
0.0000121272 * t ^ 5 -
0.0000001699 * t ^ 6 +
0.000000000875 * t ^ 7
ElseIf DecimalYear >= 1860 And DecimalYear < 1900 Then
t = DecimalYear - 1860
DeltaT = 7.62 + 0.5737 * t -
0.251754 * t ^ 2 +
0.01680668 * t ^ 3 -
0.0004473624 * t ^ 4 +
t ^ 5 / 233174
ElseIf DecimalYear >= 1900 And DecimalYear < 1920 Then
t = DecimalYear - 1900
DeltaT = -2.79 + 1.494119 * t -
0.0598939 * t ^ 2 +
0.0061966 * t ^ 3 -
0.000197 * t ^ 4
ElseIf DecimalYear >= 1920 And DecimalYear < 1941 Then
t = DecimalYear - 1920
DeltaT = 21.2 + 0.84493 * t -
0.0761 * t ^ 2 +
0.0020936 * t ^ 3
ElseIf DecimalYear >= 1941 And DecimalYear < 1961 Then
t = DecimalYear - 1950
DeltaT = 29.07 + 0.407 * t -
t ^ 2 / 233 +
t ^ 3 / 2547
ElseIf DecimalYear >= 1961 And DecimalYear < 1986 Then
t = DecimalYear - 1975
DeltaT = 45.45 + 1.067 * t -
t ^ 2 / 260 -
t ^ 3 / 718
ElseIf DecimalYear >= 1986 And DecimalYear < 2005 Then
t = DecimalYear - 2000
DeltaT = 63.86 + 0.3345 * t -
0.060374 * t ^ 2 +
0.0017275 * t ^ 3 +
0.000651814 * t ^ 4 +
0.00002373599 * t ^ 5
ElseIf DecimalYear >= 2005 And DecimalYear < 2050 Then
t = DecimalYear - 2000
DeltaT = 62.92 + 0.32217 * t +
0.005589 * t ^ 2
Else
'Date is out of bounds so Throw an exception
Throw New ArgumentOutOfRangeException("InputDate", "Input date must be between 1800 and 2050")
End If

Return DeltaT
End Function```

Again, we could use a standard function. The only argument would be DateTime, so I decided to extend the existing data type, as it makes the code more elegant. Instead of writing:

`DeltaT = GetDeltaT(DateTime)`

we simply write:

`DeltaT = DateTime.DeltaT`

Extension method returns DeltaT in seconds of time. We must add this to previously obtained Julian Day, and calculate Julian Ephemeris Day (JDE):

1. Calculate Julian Day based on UTC DateTime
2. Calculate DeltaT on the same UTC DateTime
3. Julian Ephemeris Day is then calculated as: `JDE = JD + DeltaT/86400`

It is this JDE, that is used from now on any computation regarding solar, planetary and lunar ephemerides. Up till now, we always used TT (or TBD, the difference between the two is maximum 1,6 miliseconds, and unless a meter type accuracy is required, we can safely interchange the two).

## Are the Ephemerides now correct?

Nope, they're not. What we calculated so far are Astrometric coordinates for the reference frame IERS (J2000). But Earth's axis of rotation, vhich forms the poles of Celestial Globe, is not fixed in space and time with respect to "fixed" stars. To obtain true, apparent positions of heavenly bodies, we need to rotate our frame of reference from J2000 to our exact date and time. This operation results in three corrections, being applied to both Right Ascension and Declination, namely:

These three correction, applied to Astrometric coordinates calculated before will enable us to get true apparent position of Sun, planets and Moon. So bear with me just a little bit longer, We are getting really close.

Best regards.

P.S.  If at any point whiole reading my posts on the matter, you find any error in either text or code, do not hesitate to drop me a message though the contact form.