C***********************************************************************
C
	SUBROUTINE TIMFIX( IDAT, ITIM)
C
C		FIX TIME & DATE AFTER ARITHEMETIC.
C
C	 The program puts the sum of times into ITIM & IDAT and let
C	this routine worry about the carries.
C
C  This routine adds the estimated run time to the present time
C  and calculates the date and time that the job will be completed
C
C  THE RESULT IS STORED IN THE ARRAY AS:
C
C	ITIM(1) = Hour    ITIM(2) = Minute   ITIM(3) = Second
C	IDAT(1) = Month   IDAT(2) = Day      IDAT(3) = Year
C
	IMPLICIT INTEGER*2 (I-N)
	DIMENSION ITIM(3), IDAT(3)
C
C======================================================================
C
C	FIRST DO THE TIME.  DIVISION AND THE MOD FUNCTION MAKE THIS EASY.
C
C   Add the carry from time to minutes.
	ITIM(2) = ITIM(2) + ITIM(3) / 60
C   Store the remaining seconds.
	ITIM(3) = MOD( ITIM(3), 60)
C
C   Handle minutes and hours.
	ITIM(1) = ITIM(1) + ITIM(2) / 60
	ITIM(2) = MOD( ITIM(2), 60)
C
C   Carry extra hours into days
	IDAT(2) = IDAT(2) + ITIM(1) / 24
	ITIM(1) = MOD( ITIM(1), 24)
C
C======================================================================
C
C	NOW THE HARD PART -- HOW MANY DAYS IN EACH MONTH?
C	## This piece is from the original.
C
	IMON = IDAT(1)
	IDAY = IDAT(2)
	IYR  = IDAT(3)
C
C  ALL MONTHS CAN HAVE 28 OR FEWER DAYS
C
200	IF (IDAY.LT.29) GOTO 300
C
C  FOR MONTHS OF 30 DAYS
C
	IF ((IMON.NE.4).AND.(IMON.NE.6).AND.
     1	(IMON.NE.9).AND.(IMON.NE.11)) GOTO 210
C
	IF (IDAY.LT.31) GOTO 300
	IMON = IMON + 1
	IDAY = IDAY - 30
	GOTO 300
C
C  FOR MONTHS OF 31 DAYS
C
210	IF (IMON.EQ.2) GOTO 220
C
	IF (IDAY.LT.32) GOTO 300
	IMON = IMON + 1
	IDAY = IDAY - 31
	GOTO 300
C
C  HANDLE THE ODDBALL FEBRUARY SEPERATELY
C
220	IF ((IDAY.LT.30).AND.(IYR.EQ.4*INT(IYR/4.0))) GOTO 300
	IMON = 3
	IDAY = IDAY - 28
	IF (IYR.EQ.4*INT(IYR/4.0)) IDAY = IDAY - 1
C
	IDAT(1) = IMON
	IDAT(2) = IDAY
C
C======================================================================
C
C  JUMP TO A NEW YEAR IF NECESSARY
C
300	IDAT(3) = IDAT(3) + IDAT(1) / 12
	IDAT(1) = MOD( IDAT(1), 12)
C
C  Let's just worry about this century.
	IDAT(3) = MOD( IDAT(3), 100)
C
	RETURN
	END
