      SUBROUTINE TIMOUT(NOUT,TIM)
C
C     CONVERT THE TIME FROM SECONDS TO DAYS, HOURS, MINUTES, AND SECONDS
C
      implicit double precision (A-H,O-Z)
      include 'MOP6FILE'
C
      double precision MINS, MINPHR
C
C
      data HRSPD /24.0D0/, MINPHR /60.0D0/
      data SECPD /86400.0D0/, SECPHR /3600.0D0/, SECPMI /60.0D0/
C
      DAYS = TIM / SECPD
      IDAYS = INT(DAYS)
      HOURS = (DAYS - FLOAT(IDAYS)) * HRSPD
      IHOURS = INT(HOURS)
      MINS = (HOURS - FLOAT(IHOURS)) * MINPHR
      IMINS = INT(MINS)
      SECS = (MINS - FLOAT(IMINS)) * SECPMI
C
      if (IDAYS .GT. 1) then
         write(NOUT,10) IDAYS,IHOURS,IMINS,SECS
      else if (IDAYS .EQ. 1) then
         write(NOUT,20) IDAYS,IHOURS,IMINS,SECS
      else if (IHOURS .GT. 0) then
         write(NOUT,30) IHOURS,IMINS,SECS
      else if (IMINS .GT. 0) then
         write(NOUT,40) IMINS,SECS
      else
         write(NOUT,50) SECS
      end if
C
   10 format(10X,'COMPUTATION TIME = ',I2,1X,'DAYS',2X,I2,1X,'HOURS',
     1        1X,I2,1X,'MINUTES AND',1X,F7.3,1X,'SECONDS')
   20 format(10X,'COMPUTATION TIME = ',I2,1X,'DAY',2X,I2,1X,'HOURS',
     1        1X,I2,1X,'MINUTES AND',1X,F7.3,1X,'SECONDS')
   30 format(10X,'COMPUTATION TIME = 'I2,1X,'HOURS',
     1        1X,I2,1X,'MINUTES AND',1X,F7.3,1X,'SECONDS')
   40 format(10X,'COMPUTATION TIME = ',I2,1X,'MINUTES AND',
     1        1X,F7.3,1X,'SECONDS')
   50 format(10X,'COMPUTATION TIME = ',F7.3,1X,'SECONDS')
      end
