/* support Shell starttime, stoptimer, and laptimer commands. */!!

inherit(StopWatch, #CLIStopWatch, nil, 2, nil)!!

setClassVars(CLIStopWatch, #($CLIStopWatchError))!!

now(class(CLIStopWatch))!!

now(CLIStopWatch)!!

/* Stop the StopWatch.  Return the total time elapsed. */
Def stop(self | retval localStopTime)
{ if not(startTime)
    ^$CLIStopWatchError;
  endif;
  localStopTime := Call GetCurrentTime();
  retval := localStopTime - startTime;
  startTime := nil;
  ^retval;
}!!

/* Return the time between the start time and now. */
Def lap(self)
{
  if not(startTime)
    ^$CLIStopWatchError;
  endif;
  ^Call GetCurrentTime() - startTime;
}!!

/* CLIStopWatch Class Initialization Code */
$CLIStopWatchError := 0x7fffffff;