<p>The actual equations used by NASA are located here:</p>

<p><a href="https://eclipse.gsfc.nasa.gov/SEcat5/deltatpoly.html" rel="nofollow noreferrer">https://eclipse.gsfc.nasa.gov/SEcat5/deltatpoly.html</a></p>

<p>I failed to find any pre-written code and consequently wrote my own in Swift. The equations are fairly straightforward and a list of the possible errors these equations may produce is linked to that page as well.</p>

<p>Here are the polynomials:</p>

<p>Using the ΔT values derived from the historical record and from direct observations (see: Table 1 and Table 2 ), a series of polynomial expressions have been created to simplify the evaluation of ΔT for any time during the interval -1999 to +3000.</p>

<p>We define the decimal year "y" as follows:</p>

<pre><code>    y = year + (month - 0.5)/12
</code></pre>

<p>This gives "y" for the middle of the month, which is accurate enough given the precision in the known values of ΔT. The following polynomial expressions can be used calculate the value of ΔT (in seconds) over the time period covered by of the Five Millennium Canon of Solar Eclipses: -1999 to +3000.</p>

<p>Before the year -500, calculate:</p>

<pre><code>    ΔT = -20 + 32 * u^2
    where:  u = (y-1820)/100
</code></pre>

<p>Between years -500 and +500, we use the data from Table 1, except that for the year -500 we changed the value 17190 to 17203.7 in order to avoid a discontinuity with the previous formula at that epoch. The value for ΔT is given by a polynomial of the 6th degree, which reproduces the values in Table 1 with an error not larger than 4 seconds:</p>

<pre><code>ΔT = 10583.6 - 1014.41 * u + 33.78311 * u^2 - 5.952053 * u^3
    - 0.1798452 * u^4 + 0.022174192 * u^5 + 0.0090316521 * u^6 
where: u = y/100
</code></pre>

<p>Between years +500 and +1600, we again use the data from Table 1 to derive a polynomial of the 6th degree.</p>

<pre><code>ΔT = 1574.2 - 556.01 * u + 71.23472 * u^2 + 0.319781 * u^3
    - 0.8503463 * u^4 - 0.005050998 * u^5 + 0.0083572073 * u^6
where: u = (y-1000)/100
</code></pre>

<p>Between years +1600 and +1700, calculate:</p>

<pre><code>ΔT = 120 - 0.9808 * t - 0.01532 * t^2 + t^3 / 7129
where:  t = y - 1600
</code></pre>

<p>Between years +1700 and +1800, calculate:</p>

<pre><code>ΔT = 8.83 + 0.1603 * t - 0.0059285 * t^2 + 0.00013336 * t^3 - t^4 / 1174000
where: t = y - 1700
</code></pre>

<p>Between years +1800 and +1860, calculate:</p>

<pre><code>ΔT = 13.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
where: t = y - 1800
</code></pre>

<p>Between years 1860 and 1900, calculate:</p>

<pre><code>ΔT = 7.62 + 0.5737 * t - 0.251754 * t^2 + 0.01680668 * t^3
    -0.0004473624 * t^4 + t^5 / 233174
where: t = y - 1860
</code></pre>

<p>Between years 1900 and 1920, calculate:</p>

<pre><code>ΔT = -2.79 + 1.494119 * t - 0.0598939 * t^2 + 0.0061966 * t^3 - 0.000197 * t^4
where: t = y - 1900
</code></pre>

<p>Between years 1920 and 1941, calculate:</p>

<pre><code>ΔT = 21.20 + 0.84493*t - 0.076100 * t^2 + 0.0020936 * t^3
where: t = y - 1920
</code></pre>

<p>Between years 1941 and 1961, calculate:</p>

<pre><code>ΔT = 29.07 + 0.407*t - t^2/233 + t^3 / 2547
where: t = y - 1950
</code></pre>

<p>Between years 1961 and 1986, calculate:</p>

<pre><code>ΔT = 45.45 + 1.067*t - t^2/260 - t^3 / 718
where: t = y - 1975
</code></pre>

<p>Between years 1986 and 2005, calculate:</p>

<pre><code>ΔT = 63.86 + 0.3345 * t - 0.060374 * t^2 + 0.0017275 * t^3 + 0.000651814 * t^4 
    + 0.00002373599 * t^5
where: t = y - 2000
</code></pre>

<p>Between years 2005 and 2050, calculate:</p>

<pre><code>ΔT = 62.92 + 0.32217 * t + 0.005589 * t^2
where: t = y - 2000
</code></pre>

<p>This expression is derived from estimated values of ΔT in the years 2010 and 2050. The value for 2010 (66.9 seconds) is based on a linearly extrapolation from 2005 using 0.39 seconds/year (average from 1995 to 2005). The value for 2050 (93 seconds) is linearly extrapolated from 2010 using 0.66 seconds/year (average rate from 1901 to 2000).</p>

<p>Between years 2050 and 2150, calculate:</p>

<pre><code>ΔT = -20 + 32 * ((y-1820)/100)^2 - 0.5628 * (2150 - y)
</code></pre>

<p>The last term is introduced to eliminate the discontinuity at 2050.</p>

<p>After 2150, calculate:</p>

<pre><code>ΔT = -20 + 32 * u^2
where:  u = (y-1820)/100
</code></pre>

<p>All values of ΔT based on Morrison and Stephenson [2004] assume a value for the Moon's secular acceleration of -26 arcsec/cy^2. However, the ELP-2000/82 lunar ephemeris employed in the Canon uses a slightly different value of -25.858 arcsec/cy^2. Thus, a small correction "c" must be added to the values derived from the polynomial expressions for ΔT before they can be used in the Canon</p>

<pre><code>c = -0.000012932 * (y - 1955)^2
</code></pre>

<p>Since the values of ΔT for the interval 1955 to 2005 were derived independent of any lunar ephemeris, no correction is needed for this period.</p>

CC BY-SA 3.0
2017-01-26T18:41:53.047Z
2017-01-26T23:04:46.163Z
2017-01-26T23:04:46.163Z
Aloft
<p>A historical table from 1961 to the present of TAI-UTC is maintained here:</p>

<p><a href="ftp://hpiers.obspm.fr/iers/bul/bulc/UTC-TAI.history" rel="nofollow noreferrer">ftp://hpiers.obspm.fr/iers/bul/bulc/UTC-TAI.history</a></p>

<p>Delta T can be calculated by adding 32.184s, the difference between TT and TAI, to the value (TAI-UTC) in the table.</p>

<p>So currently Delta T is about 68 and will likely be 69 in a few years. It's increasing by one every 3 years or so.</p>

<p>However, values of UTC are adjusted with leap seconds so we can use precision clocks that aren't continuously tweaked. UT1 is the precise measure of "Earth" time. You can modify this to reference UT1 using the DUT1 value which is distributed with NIST time signals, WWV etc. It's value is published here:</p>

<p><a href="http://hpiers.obspm.fr/eoppc/bul/buld/bulletind.131" rel="nofollow noreferrer">http://hpiers.obspm.fr/eoppc/bul/buld/bulletind.131</a></p>

CC BY-SA 3.0
2016-11-27T06:43:33.303Z
2016-11-27T07:14:50.583Z
2016-11-27T07:14:50.583Z
doug
<p>I'm not aware of any APIs that provide $\Delta T$, but you may be able to parse <a href="https://datacenter.iers.org/eop/-/somos/5Rgv/latest/16" rel="nofollow noreferrer">https://datacenter.iers.org/eop/-/somos/5Rgv/latest/16</a> for the value $\Delta T$.</p>

<p>Of course if you want to calculate the <em>approximate</em> position of the Sun, a few second more or less should not matter too much ;-)</p>

CC BY-SA 3.0
2016-11-25T13:57:44.400Z
2016-11-25T13:57:44.400Z
Dieudonné
<p>I'm currently developing a javascript application in which I want to calculate the approximate position of the sun. This works quite fine but requires the value for deltaT (TT-UT) to be set depending on the year for which I want to calculate the solar position. </p>

<p>Currently, I'm using a default value of 67 for my calculation. However, since I want to calculate the solar position for several years I'm looking for a convenient way to obtain the deltaT value for each year.</p>

<p>To all of you, that have some experience with programming:
Is there any interface (API) that provides me with the desired values?
Of course, it would also be sufficient to get the universal and terrestrial time so that I can calculate deltaT on my own.</p>

CC BY-SA 3.0
2016-11-27T16:32:12.920Z
Errors in Delta T mostly affect calculations of local bodies. Even if one was off 10's of seconds the impact on calculating the Sun's position is miniscule. It's really more useful for things like figuring out the land path of a past or future solar eclipse.
doug
CC BY-SA 3.0
2016-11-30T12:57:30.597Z
Actually, I want to calculate the approximate topographic solar position for georeferenced videos, so that I can roughly estimate the illumination of their contents. In fact, this is working quite good currently. However, since this calculation is done for scientific research I was looking for a more sophisticated solution. But maybe I have to accept this inaccuracy since it seems to be a minor one. Nevertheless, thanks to all of you for answering to my question!
TobsenB
<the-sun><software><time><azimuth>
Obtaining deltaT for use in software
TobsenB
# Obtaining deltaT for use in software

(Asked by: username_0 on 2016-11-25)

I'm currently developing a javascript application in which I want to calculate the approximate position of the sun. This works quite fine but requires the value for deltaT (TT-UT) to be set depending on the year for which I want to calculate the solar position.

Currently, I'm using a default value of 67 for my calculation. However, since I want to calculate the solar position for several years I'm looking for a convenient way to obtain the deltaT value for each year.

To all of you, that have some experience with programming:
Is there any interface (API) that provides me with the desired values?
Of course, it would also be sufficient to get the universal and terrestrial time so that I can calculate deltaT on my own.

**Tags:** the-sun, software, time, azimuth
> **Comments:**
> **username_1**: Errors in Delta T mostly affect calculations of local bodies. Even if one was off 10's of seconds the impact on calculating the Sun's position is miniscule. It's really more useful for things like figuring out the land path of a past or future solar eclipse.  
> **username_0**: Actually, I want to calculate the approximate topographic solar position for georeferenced videos, so that I can roughly estimate the illumination of their contents. In fact, this is working quite good currently. However, since this calculation is done for scientific research I was looking for a more sophisticated solution. But maybe I have to accept this inaccuracy since it seems to be a minor one. Nevertheless, thanks to all of you for answering to my question!  

---

## 3 answers

### Answer by username_2 on 2017-01-26. Score: 2

The actual equations used by NASA are located here:
https://eclipse.gsfc.nasa.gov/SEcat5/deltatpoly.html
I failed to find any pre-written code and consequently wrote my own in Swift. The equations are fairly straightforward and a list of the possible errors these equations may produce is linked to that page as well.
Here are the polynomials:
Using the ΔT values derived from the historical record and from direct observations (see: Table 1 and Table 2 ), a series of polynomial expressions have been created to simplify the evaluation of ΔT for any time during the interval -1999 to +3000.
We define the decimal year "y" as follows:
    y = year + (month - 0.5)/12

This gives "y" for the middle of the month, which is accurate enough given the precision in the known values of ΔT. The following polynomial expressions can be used calculate the value of ΔT (in seconds) over the time period covered by of the Five Millennium Canon of Solar Eclipses: -1999 to +3000.
Before the year -500, calculate:
    ΔT = -20 + 32 * u^2
    where:  u = (y-1820)/100

Between years -500 and +500, we use the data from Table 1, except that for the year -500 we changed the value 17190 to 17203.7 in order to avoid a discontinuity with the previous formula at that epoch. The value for ΔT is given by a polynomial of the 6th degree, which reproduces the values in Table 1 with an error not larger than 4 seconds:
ΔT = 10583.6 - 1014.41 * u + 33.78311 * u^2 - 5.952053 * u^3
    - 0.1798452 * u^4 + 0.022174192 * u^5 + 0.0090316521 * u^6 
where: u = y/100

Between years +500 and +1600, we again use the data from Table 1 to derive a polynomial of the 6th degree.
ΔT = 1574.2 - 556.01 * u + 71.23472 * u^2 + 0.319781 * u^3
    - 0.8503463 * u^4 - 0.005050998 * u^5 + 0.0083572073 * u^6
where: u = (y-1000)/100

Between years +1600 and +1700, calculate:
ΔT = 120 - 0.9808 * t - 0.01532 * t^2 + t^3 / 7129
where:  t = y - 1600

Between years +1700 and +1800, calculate:
ΔT = 8.83 + 0.1603 * t - 0.0059285 * t^2 + 0.00013336 * t^3 - t^4 / 1174000
where: t = y - 1700

Between years +1800 and +1860, calculate:
ΔT = 13.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
where: t = y - 1800

Between years 1860 and 1900, calculate:
ΔT = 7.62 + 0.5737 * t - 0.251754 * t^2 + 0.01680668 * t^3
    -0.0004473624 * t^4 + t^5 / 233174
where: t = y - 1860

Between years 1900 and 1920, calculate:
ΔT = -2.79 + 1.494119 * t - 0.0598939 * t^2 + 0.0061966 * t^3 - 0.000197 * t^4
where: t = y - 1900

Between years 1920 and 1941, calculate:
ΔT = 21.20 + 0.84493*t - 0.076100 * t^2 + 0.0020936 * t^3
where: t = y - 1920

Between years 1941 and 1961, calculate:
ΔT = 29.07 + 0.407*t - t^2/233 + t^3 / 2547
where: t = y - 1950

Between years 1961 and 1986, calculate:
ΔT = 45.45 + 1.067*t - t^2/260 - t^3 / 718
where: t = y - 1975

Between years 1986 and 2005, calculate:
ΔT = 63.86 + 0.3345 * t - 0.060374 * t^2 + 0.0017275 * t^3 + 0.000651814 * t^4 
    + 0.00002373599 * t^5
where: t = y - 2000

Between years 2005 and 2050, calculate:
ΔT = 62.92 + 0.32217 * t + 0.005589 * t^2
where: t = y - 2000

This expression is derived from estimated values of ΔT in the years 2010 and 2050. The value for 2010 (66.9 seconds) is based on a linearly extrapolation from 2005 using 0.39 seconds/year (average from 1995 to 2005). The value for 2050 (93 seconds) is linearly extrapolated from 2010 using 0.66 seconds/year (average rate from 1901 to 2000).
Between years 2050 and 2150, calculate:
ΔT = -20 + 32 * ((y-1820)/100)^2 - 0.5628 * (2150 - y)

The last term is introduced to eliminate the discontinuity at 2050.
After 2150, calculate:
ΔT = -20 + 32 * u^2
where:  u = (y-1820)/100

All values of ΔT based on Morrison and Stephenson [2004] assume a value for the Moon's secular acceleration of -26 arcsec/cy^2. However, the ELP-2000/82 lunar ephemeris employed in the Canon uses a slightly different value of -25.858 arcsec/cy^2. Thus, a small correction "c" must be added to the values derived from the polynomial expressions for ΔT before they can be used in the Canon
c = -0.000012932 * (y - 1955)^2

Since the values of ΔT for the interval 1955 to 2005 were derived independent of any lunar ephemeris, no correction is needed for this period.


---

### Answer by username_1 on 2016-11-27. Score: 0

A historical table from 1961 to the present of TAI-UTC is maintained here:

<ftp://hpiers.obspm.fr/iers/bul/bulc/UTC-TAI.history>

Delta T can be calculated by adding 32.184s, the difference between TT and TAI, to the value (TAI-UTC) in the table.

So currently Delta T is about 68 and will likely be 69 in a few years. It's increasing by one every 3 years or so.

However, values of UTC are adjusted with leap seconds so we can use precision clocks that aren't continuously tweaked. UT1 is the precise measure of "Earth" time. You can modify this to reference UT1 using the DUT1 value which is distributed with NIST time signals, WWV etc. It's value is published here:

<http://hpiers.obspm.fr/eoppc/bul/buld/bulletind.131>


---

### Answer by username_3 on 2016-11-25. Score: 0

I'm not aware of any APIs that provide $\Delta T$, but you may be able to parse <https://datacenter.iers.org/eop/-/somos/5Rgv/latest/16> for the value $\Delta T$.

Of course if you want to calculate the *approximate* position of the Sun, a few second more or less should not matter too much ;-)


---

