ann.util.Timer

 

Timer.java provides a simple 'stopwatch' timer for timing execution.

 

public Timer()

Default constructor

Postcondition: the timer is not running.

 

public void start()

Start the timer.

Postcondition: the timer is running and the system time has been remembered as the starting time.

 

public void stop()

Stop the timer.

Postcondition: the timer is not running and the system time has been remembered as the stopping time.

 

public void reset()

Reset the timer.

Postcondition: the system time has been remembered as the starting time.

 

public double getTime()

Get the time from the timer in seconds.

Return: if the timer is running compute the difference between the current system time and the starting time, otherwise, compute the difference between the stopping time and the starting time

 

public String toString()

String converter (output)

Return: the String equivalent to my time in seconds.

 

 

 

 


Back to the package documentation index


Back to the Introduction


Copyright 2000 by Prentice Hall. All rights reserved.