      SUBROUTINE TIMEIT(CMSGTM,DTIME)
      IMPLICIT NONE
C
C     timeit_ibm6000
c history
C 94.06.20 (PJF) add dtime to the formal parameters
C 95.06.19 (PJF) modified to suppress printing if CMSGTM='noprint'
C 04.04.05 (BTD) changed IF(CMSGTM(1:7).NE.. to IF(CMSGTM.NE..
C end history
C This version of timeit uses the system call "mclock" available under
C RISC6000/320 IBM AIX3.1
C
C Copyright (C) 1993,1995,2004 B.T. Draine and P.J. Flatau
C This code is covered by the GNU General Public License.
C***********************************************************************
C Arguments:
      CHARACTER CMSGTM* (*)
      REAL DTIME
C
C Local variables:
      REAL OLDTIM
      CHARACTER CSTA*3, CMSGNM*70
      INTEGER I1,I2,IALL
C
C External Subroutines ..
      EXTERNAL WRIMSG
C
C External Functions ..
      INTEGER MCLOCK
      EXTERNAL MCLOCK
C
      DATA CSTA/'ONE'/
C
      IF(CSTA.EQ.'ONE')THEN
         CSTA='TWO'
         I1=MCLOCK()
      ELSEIF(CSTA.EQ.'TWO')THEN
         CSTA='ONE'
         I2=MCLOCK()
         IALL=I2-I1
         DTIME=FLOAT(IALL)/100.
         IF(CMSGTM.NE.'NOPRINT'.AND.CMSGTM.NE.'noprint')THEN
            WRITE(CMSGNM,FMT='(A,A)')' Timing results for: ',CMSGTM
            CALL WRIMSG('TIMEIT',CMSGNM)
            WRITE(CMSGNM,FMT='(G15.6, A)')DTIME,' CPU time (in secs) '
            CALL WRIMSG('TIMEIT',CMSGNM)
         ENDIF
      ENDIF
      RETURN
      END
