C
C     We are not interested in CPU-times. We can get them from time-command
C     at the script level. Within program we look for wall clock times only.
C
C     WALTIM is a C-routine, found in times.c -file: waltim_(...)
C
      BLOCK DATA TIIMEX
      implicit none
      include 'timer.inc'
      DATA TSTART /0.0/
      DATA TEND   /0.0/
      DATA INITED /0/
      END
C
      SUBROUTINE INITIM(IDUMMY)
      implicit none
      include 'timer.inc'
      integer IDUMMY
      EXTERNAL WALTIM
      IF (INITED.EQ.0) THEN
         CALL WALTIM(TSTART)
         INITED = 1
      ENDIF
      END
C
      SUBROUTINE SHOTIM(IDUMMY)
      implicit none
      include 'timer.inc'
      integer IDUMMY
      EXTERNAL WALTIM
      IF (INITED.EQ.0) CALL INITIM(IDUMMY)
      CALL WALTIM(TEND)
      WRITE(*,1000) 'Shotim: ',TEND - TSTART,' secs'
 1000 FORMAT(1X,A,F15.4,A)
      END
C
      FUNCTION CPUTIM(IDUMMY)
      implicit none
      include 'timer.inc'
      REAL CPUTIM
      integer IDUMMY
      EXTERNAL WALTIM
      REAL T
      IF (INITED.EQ.0) CALL INITIM(IDUMMY)
      CALL WALTIM(T)
      CPUTIM = T - TSTART
      END
C
      SUBROUTINE TIMER(T)
      implicit none
      include 'timer.inc'
      REAL T
      integer IDUMMY
      EXTERNAL WALTIM
      IF (INITED.EQ.0) CALL INITIM(IDUMMY)
      CALL WALTIM(T)
      END

