      SUBROUTINE HTOEJD(Q,TQ,NQ,LIM,SAMTIM,HELJD,NORUN)     
C     
C     ROUTINE TO CORRECT THE HELIOCENTRIC TIMES TO EPHEMERIS TIME 
C     
      DIMENSION Q(NQ),LIM(2,NORUN),SAMTIM(NORUN)   
      DOUBLE PRECISION TQ(NQ),HELJD(NORUN)     
      DIMENSION JDBGYR(21),DT(21)   
      DATA JDBGYR/  586,  951, 1316, 1682, 2047, 2412, 2777, 3143,
     *             3508, 3873, 4238, 4604, 4969, 5334, 5699, 6065,
     *             6430, 6795, 7161, 7527, 7892/
      DATA     DT/40.18,41.17,42.23,43.37,44.49,45.48,46.46,47.52,
     *            48.53,49.59,50.54,51.38,52.17,52.96,53.79,54.34,
     *             54.9, 55.4, 55.8, 56.3, 56.7/   
      DO 50 J=1,NORUN   
        KBEGIN=LIM(1,J) 
        KEND=LIM(2,J)   
        JD=HELJD(J)     
        IF(JD.LT.586.OR.JD.GT.7892)THEN   
   10     PRINT 15,JD   
   15     FORMAT(' ***ERROR***ERROR***'/' HTOEJD WILL NOT WORK WITH'/   
     *           ' JULIAN DATE ',I5/' MUST BE IN RANGE 586-7892') 
          STOP    
        END IF    
        DO 20 K=1,21
          IF(JD.GE.JDBGYR(K).AND.JD.LE.JDBGYR(K+1))THEN     
            DELTAT = DT(K) + FLOAT(JD-JDBGYR(K)) /    
     *                       FLOAT(JDBGYR(K+1)-JDBGYR(K)) * 
     *                       (DT(K+1)-DT(K))    
            GO TO 22    
          END IF  
   20   CONTINUE  
        PRINT 15,JD
        STOP
       
   22   PRINT 25,J,KBEGIN,KEND,DELTAT     
   25   FORMAT(12X,'CORRECTING RUN ',I3,' FROM ',I5,' TO ',I5,    
     *         ' BY ADDING ',F7.2)  
        DO 40 K=KBEGIN,KEND   
          TQ(K)=TQ(K)+DELTAT  
   40   CONTINUE  
   50 CONTINUE    
      RETURN
      END   
