C+ C NAME: C StopWatch C PURPOSE: C Display time difference between start and stop time C (start time can be set internally; stop time can be system time) C CALLING SEQUENCE: subroutine StopWatch(cStartIn,cStopIn) C INPUTS: (read-only) C cStart character*(*) start time string; absolute time C cStop character*(*) (optional) stop time string C special value cStop = ' ' or cStop = '_' C OUTPUTS: C Displayed on screen C CALLS: C StopWatchSub, cTime2System, Time2Str C RESTRICTIONS: C No check is made whether START is in the proper absolute time format. C If not, all bets are off. C PROCEDURE: C > If START .eq. ' ': C - the first call to StopWatch will set and save the system time C - the second call to StopWatch will display the elapsed time between C the cStart time set in the previous call and the specified cStop time. C > If cStart .ne. ' ': C - the start time must be in absolute time format YYY/MN/DD hh:mm:ss.ss, C > If cStop = ' ' or cStop = '_' the current system time is used as stop C time. Otherwise it must be an absolute time C MODIFICATION HISTORY: C JAN-1993, Paul Hick (UCSD/CASS) C Original written in Lindau. C NOV-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C Rewritten using Time2* routines. C- character cStartIn*(*) character cStopIn *(*) character cStart *19 /' '/ character cStop *19 character cTime2System*80 character cLapsed*15 save cStart if (cStartIn .ne. ' ') then cStart = cStartIn else if (cStart .eq. ' ') then cStart = cTime2System(' ') write (*,'(//,10X,2A,//)') 'Stopwatch started on ',cStart return end if cStop = cStopIn if (cStop .eq. ' ') cStop = '_' call StopWatchSub(cStart,cStop,cLapsed) write (*,'(//,10X,46(1H*))') write (*,'(10X,1H*,5X,2A,5X,1H*)') 'Start time : ',cStart write (*,'(10X,1H*,5X,2A,5X,1H*)') 'End time : ',cStop write (*,'(10X,1H*,5X,A,7X,A,2X,1H*)') 'Time elapsed : ',cLapsed write (*,'(10X,46(1H*),//)') cStart = ' ' return end