home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adaptor.zip / adapt.zip / adaptor / examples / dalib / timing / time.f < prev   
Text File  |  1993-03-23  |  2KB  |  61 lines

  1.       program time
  2.  
  3.       real tstart, tstop
  4.       integer i
  5.       logical wait
  6.       integer calls
  7.       
  8.       call walltime (tstart)
  9.       call cm_timer_clear (0)
  10.       call cm_timer_clear (1)
  11.       call cm_timer_clear (2)
  12.  
  13.       do i = 1, 120
  14. c       wait for next second
  15.         wait = .true.
  16.         calls = 0
  17.         do while (wait)
  18.            calls = calls + 1
  19.            call walltime (tstop)
  20.            wait = (tstop .lt. tstart + i)
  21.         end do
  22.         print *, i, ' seconds (needed ', calls, ' calls)'
  23.         if (i .eq. 10) then
  24.            print *, 'Starting Timer 0'
  25.            call cm_timer_start (0)
  26.         end if
  27.         if (i .eq. 20) then
  28.            print *, 'Starting Timer 1 and 2, stop Timer 0'
  29.            call cm_timer_stop (0)
  30.            call cm_timer_start (1)
  31.            call cm_timer_start (2)
  32.         end if
  33.         if (i .eq. 35) then
  34.            print *, 'stop Timer 1'
  35.            print *, 'start Timer 0'
  36.            call cm_timer_stop (1)
  37.            call cm_timer_start (0)
  38.         end if
  39.         if (i .eq. 45) then
  40.            print *, 'stop Timer 2'
  41.            print *, 'stop Timer 0'
  42.            call cm_timer_stop (2)
  43.            call cm_timer_stop (0)
  44.         end if
  45.         if (mod (I,2) .eq. 1) then
  46.            call cm_timer_start (3)
  47.          else
  48.            call cm_timer_stop (3)
  49.         end if
  50.       end do
  51.  
  52.       print *, 'Timer 0 should have 20 seconds'
  53.       call cm_timer_print (0)
  54.       print *, 'Timer 1 should have 15 seconds'
  55.       call cm_timer_print (1)
  56.       print *, 'Timer 2 should have 25 seconds'
  57.       call cm_timer_print (2)
  58.       print *, 'Timer 3 should have 60 seconds'
  59.       call cm_timer_print (3)
  60.       end
  61.