com.diasparsoftware.gsbase
Class SystemClockStopwatch

java.lang.Object
  extended bycom.diasparsoftware.gsbase.SystemClockStopwatch
All Implemented Interfaces:
Stopwatch

public class SystemClockStopwatch
extends java.lang.Object
implements Stopwatch

An production-quality implementation of com.gargoylesoftware.base.util.Stopwatch that uses the system clock.

Version:
$Revision: 1.1 $
Author:
J. B. Rainsberger

Constructor Summary
SystemClockStopwatch()
           
 
Method Summary
 long getLastTime()
          Returns the last time interval recorded by the stopwatch.
 void reset()
          Resets the stopwatch, clearing the last time and preparing the shopwatch to be started again.
 void start()
          Start the stopwatch.
 void stop()
          Stops the stopwatch.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemClockStopwatch

public SystemClockStopwatch()
Method Detail

start

public void start()
Description copied from interface: Stopwatch
Start the stopwatch. This method will restart the stopwatch if it is already running.

Specified by:
start in interface Stopwatch

stop

public void stop()
Description copied from interface: Stopwatch
Stops the stopwatch. This method has no effect if the stopwatch is already stopped.

Specified by:
stop in interface Stopwatch

reset

public void reset()
Description copied from interface: Stopwatch
Resets the stopwatch, clearing the last time and preparing the shopwatch to be started again.

Specified by:
reset in interface Stopwatch

getLastTime

public long getLastTime()
Description copied from interface: Stopwatch
Returns the last time interval recorded by the stopwatch. Formally, this is the difference in time between when you last invoked stop() after having invoked start().

Specified by:
getLastTime in interface Stopwatch
Returns:
The last time interval recorded by the stopwatch, or 0 if the stopwatch has been reset or never used.


Copyright © 2003-2004 Diaspar Software Services, Inc.. All Rights Reserved.