      REAL*8 FUNCTION DELTAT( YEAR )
C
C     GIVEN A YEAR AND FRACION OF YEAR, THIS FUNCTION RETURNS AN
C     APPROXIMATION OF THE VALUE OF DELTAT = TD - UT AT THE GIVEN TIME.
C     BASED ON ALGORITHMS PRESENTED IN "ASTRONOMICAL ALGORITHMS" BY
C     JEAN MEEUS, WILLMAN-BELL, 1991.
C
C     NOTE: THE VALUE IS RETURNED AS A REAL*8 MERELY TO FACILITATE ITS
C     SUBSEQUENT ADDITION TO A REAL*8 TIME; THE APPROXIMATIONS USED
C     HERE FOR DELTAT DO NOT THEMSELVES WARRANT THE USE OF DOUBLE
C     PRECISION.
C
C     B. KNAPP, 1992-05-05, 2001-04-24 (i*4)
C
C     CHANGE LOG
C        1995-08-29  B. KNAPP  ADD DATA FROM 1996 ASTRONOMICAL ALMANAC
C                              (P. K9), AND EXTRAPOLATIONS TO 2002.
C        1998-01-02  B. KNAPP  ADD DATA FROM 1998 ASTRONOMICAL ALMANAC
C                              (AND EXTRAPOLATE, 1997 TO 2019)
C        1999-01-20  B. KNAPP  ADD DATA FROM 1999 ASTRONOMICAL ALMANAC
C                              AND EXTRPOLATE, 1998 TO 2019
C        2000-05-08  B. KNAPP  ADD DATA FROM 2000 ASTRONOMICAL ALMANAC
C                              AND EXTRPOLATE, 1999 TO 2019
C        2000-09-18  B. KNAPP  ADJUST COEFFS FOR MEEUS 2ND FORMULA
C                              (948 < Y < 1620) SO IT YIELDS 1830 FOR
C                              Y = 948 AND 124 FOR Y = 1620.
C
C
C     RCS DATA
C     
C     $Header$
C     
C     $Log$
C
C
      IMPLICIT NONE
C
C     INPUT
      REAL*8 YEAR
C
C     LOCAL VARIABLES
      REAL*8 T, F
      INTEGER*4 J
C
C     CONSTANTS
      INTEGER*4 NYRS
      PARAMETER (NYRS=400)
C
      REAL*8 DT(NYRS) /
C
C     1620-1659
     & 124.00, 119.00, 115.00, 110.00, 106.00, 102.00,  98.00,  95.00,
     &  91.00,  88.00,  85.00,  82.00,  79.00,  77.00,  74.00,  72.00,
     &  70.00,  67.00,  65.00,  63.00,  62.00,  60.00,  58.00,  57.00,
     &  55.00,  54.00,  53.00,  51.00,  50.00,  49.00,  48.00,  47.00,
     &  46.00,  45.00,  44.00,  43.00,  42.00,  41.00,  40.00,  38.00,
C
C     1660-1699
     &  37.00,  36.00,  36.00,  34.00,  33.00,  32.00,  31.00,  30.00,
     &  28.00,  27.00,  26.00,  25.00,  24.00,  23.00,  22.00,  21.00,
     &  20.00,  19.00,  18.00,  17.00,  16.00,  15.00,  14.00,  14.00,
     &  13.00,  12.00,  12.00,  11.00,  11.00,  10.00,  10.00,  10.00,
     &   9.00,   9.00,   9.00,   9.00,   9.00,   9.00,   9.00,   9.00,
C
C     1700-1739
     &   9.00,   9.00,   9.00,   9.00,   9.00,   9.00,   9.00,   9.00,
     &  10.00,  10.00,  10.00,  10.00,  10.00,  10.00,  10.00,  10.00,
     &  10.00,  11.00,  11.00,  11.00,  11.00,  11.00,  11.00,  11.00,
     &  11.00,  11.00,  11.00,  11.00,  11.00,  11.00,  11.00,  11.00,
     &  11.00,  11.00,  12.00,  12.00,  12.00,  12.00,  12.00,  12.00,
C
C     1740-1779
     &  12.00,  12.00,  12.00,  12.00,  13.00,  13.00,  13.00,  13.00,
     &  13.00,  13.00,  13.00,  14.00,  14.00,  14.00,  14.00,  14.00,
     &  14.00,  14.00,  15.00,  15.00,  15.00,  15.00,  15.00,  15.00,
     &  15.00,  16.00,  16.00,  16.00,  16.00,  16.00,  16.00,  16.00,
     &  16.00,  16.00,  16.00,  17.00,  17.00,  17.00,  17.00,  17.00,
C
C     1780-1819
     &  17.00,  17.00,  17.00,  17.00,  17.00,  17.00,  17.00,  17.00,
     &  17.00,  17.00,  17.00,  17.00,  16.00,  16.00,  16.00,  16.00,
     &  15.00,  15.00,  14.00,  14.00,  13.70,  13.40,  13.10,  12.90,
     &  12.70,  12.60,  12.50,  12.50,  12.50,  12.50,  12.50,  12.50,
     &  12.50,  12.50,  12.50,  12.50,  12.50,  12.40,  12.30,  12.20,
C
C     1820-1859
     &  12.00,  11.70,  11.40,  11.10,  10.60,  10.20,   9.60,   9.10,
     &   8.60,   8.00,   7.50,   7.00,   6.60,   6.30,   6.00,   5.80,
     &   5.70,   5.60,   5.60,   5.60,   5.70,   5.80,   5.90,   6.10,
     &   6.20,   6.30,   6.50,   6.60,   6.80,   6.90,   7.10,   7.20,
     &   7.30,   7.40,   7.50,   7.60,   7.70,   7.70,   7.80,   7.80,
C
C     1860-1899
     &   7.88,   7.82,   7.54,   6.97,   6.40,   6.02,   5.41,   4.10,
     &   2.92,   1.82,   1.61,   0.10,  -1.02,  -1.28,  -2.69,  -3.24,
     &  -3.64,  -4.54,  -4.71,  -5.11,  -5.40,  -5.42,  -5.20,  -5.46,
     &  -5.46,  -5.79,  -5.63,  -5.64,  -5.80,  -5.66,  -5.87,  -6.01,
     &  -6.19,  -6.64,  -6.44,  -6.47,  -6.09,  -5.76,  -4.66,  -3.74,
C
C     1900-1939
     &  -2.72,  -1.54,  -0.02,   1.24,   2.64,   3.86,   5.37,   6.14,
     &   7.75,   9.13,  10.46,  11.53,  13.36,  14.65,  16.01,  17.20,
     &  18.24,  19.06,  20.25,  20.95,  21.16,  22.25,  22.41,  23.03,
     &  23.49,  23.62,  23.86,  24.49,  24.34,  24.08,  24.02,  24.00,
     &  23.87,  23.95,  23.86,  23.93,  23.73,  23.92,  23.96,  24.02,
C
C     1940-1979
     &  24.33,  24.83,  25.30,  25.70,  26.24,  26.77,  27.28,  27.78,
     &  28.25,  28.71,  29.15,  29.57,  29.97,  30.36,  30.72,  31.07,
     &  31.35,  31.68,  32.18,  32.68,  33.15,  33.59,  34.00,  34.47,
     &  35.03,  35.73,  36.54,  37.43,  38.29,  39.20,  40.18,  41.17,
     &  42.23,  43.37,  44.49,  45.48,  46.46,  47.52,  48.53,  49.59,
C
C     1980-2019  (1999-2019 ARE EXTRAPOLATIONS!)
     &  50.54,  51.38,  52.17,  52.96,  53.79,  54.34,  54.87,  55.32,
     &  55.82,  56.30,  56.86,  57.57,  58.31,  59.12,  59.98,  60.78,
     &  61.63,  62.29,  62.97,  63.89,  64.70,  65.53,  66.36,  67.20,
     &  68.08,  68.97,  69.86,  70.75,  71.65,  72.56,  73.47,  74.38,
     &  75.30,  76.22,  77.14,  78.08,  79.01,  79.95,  80.89,  81.84 /
C
      SAVE DT
C
      T = (YEAR-2000.0D0)/100.0D0
      IF ( YEAR .LT. 948. ) THEN
C
         DELTAT = 2715.5736D0 + (573.36D0 + 46.5D0*T)*T
C
      ELSE IF ( YEAR .LT. 1620. ) THEN
C
         DELTAT = 51.29021505D0 +(65.65601680D0 + 22.31320282D0*T)*T
C
      ELSE
C
         J = MAX( 1, MIN( NYRS-1, INT( YEAR ) - 1619 ) )
         F = YEAR - 1619.0D0 - J
         DELTAT = (1.-F)*DT(J) + F*DT(J+1)
C
      ENDIF
C
      RETURN
      END
