      FUNCTION NEWTIM (ITIME,DTM,OK)
C
C     * F. MAJAESS - MAR 24/99 - REPLACE THE "ABORT" CALL BY A CALL TO "XIT".
C     * M. LAZARE -- AUG 06/91 - DE-ACTIVATE DTM=2 FOR 32-BIT MACHINES.  
C     * F. ZWIERS -- DEC 27/84
C 
C     * PURPOSE -- TO CONVERT ONE OF THE FOUR APPROVED TIME FORMATS INTO
C     *            COUNT TYPE UNITS.
C     * 
C     * IF DTM=0 THEN TIME IS IN COUNT UNITS SO RETURN
C     * IF DTM=1 THEN TIME IS IN FORMAT YYMMDDHH. TIME IS CONVERTED TO HOURS. 
C     * IF DTM=2 THEN TIME IS IN FORMAT YYMMDDHHMM. TIME IS CONVERTED TO
C     *          MINUTES. (DEACTIVATED).
C     * IF DTM=3 THEN TIME IS IN FORMAT YYMMDDHH. TIME IS CONVERTED TO
C     *          HOURS AND LEAP YEARS ARE TAKEN INTO ACCOUNT. 
C     *          YEARS ARE COUNTED AS YEARS SINCE 1900 AD.
C     * 
C     * CONSISTENCY CHECKING IS PERFORMED AND OK IS RETURNED FALSE IF 
C     * AN INCONSISTENCY IS DETECTED. 
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      INTEGER DTM,TIME,YY,MM,DD,HH,MINN,JDAYS(12)
      LOGICAL OK,OBS
      DATA JDAYS/0,31,59,90,120,151,181,212,243,273,304,334/
C 
C-------------------------------------------------------------------------
C 
      OK=.TRUE.
      OBS=.FALSE. 
      MINN=0 
      TIME=ITIME
      NEWTIM=-999999999
      IF(DTM.EQ.0)THEN
         NEWTIM=TIME
      ELSEIF(DTM.EQ.1)THEN
         YY=TIME/1000000
         TIME=TIME-YY*1000000 
         MM=TIME/10000
         TIME=TIME-MM*10000 
         DD=TIME/100
         HH=TIME-DD*100 
         CALL CHECKT(ITIME,YY,MM,DD,HH,MINN,OBS,OK)
         IF(OK) NEWTIM=HH + (DD - 1 + JDAYS(MM) + YY*365)*24
      ELSEIF(DTM.EQ.2)THEN
C        YY=TIME/100000000
C        TIME=TIME-YY*100000000 
C        MM=TIME/1000000
C        TIME=TIME-MM*1000000 
C        DD=TIME/10000
C        TIME=TIME-DD*10000 
C        HH=TIME/100
C        MIN=TIME-HH*100
C        CALL CHECKT(ITIME,YY,MM,DD,HH,MIN,OBS,OK)
C        IF(OK) NEWTIM=MIN +
C    1                  (HH + (DD - 1 + JDAYS(MM) + YY*365)*24)*60
         WRITE(6,6000)
         CALL                                     XIT('NEWTIM',-1)
      ELSEIF(DTM.EQ.3)THEN
         OBS=.TRUE.
         YY=TIME/1000000
         TIME=TIME-YY*1000000 
         MM=TIME/10000
         TIME=TIME-MM*10000 
         DD=TIME/100
         HH=TIME-DD*100 
         CALL CHECKT(ITIME,YY,MM,DD,HH,MINN,OBS,OK)
         IF(OK)THEN 
            NLEAP=YY/4 + 1
            IF(MM.LE.2 .AND. (YY/4)*4.EQ.YY)
     1                                                 NLEAP=NLEAP-1
            NEWTIM=HH + 
     1            (DD - 1 + JDAYS(MM) + YY*365 + NLEAP)*24
         ENDIF
      ELSE
         OK=.FALSE. 
      ENDIF 
C 
C-------------------------------------------------------------------------- 
C 
 6000 FORMAT(' NEWTIM - SORRY, THE DTM=2 OPTION IS DEACTIVATED')
      RETURN
      END
