|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object structure.Clock
public class Clock
A simple object for measuring time. This Clock allows one to measure time between events. Events may be from several milliseconds to several seconds apart. When measuring events that take considerable time (> 1/10th of a second) it is important to counteract the effect of scheduling of other system processes. A Clock has the following operations:
Clock timer = new Clock(); timer.start()
; for (i = 0; i < 100000; i++); timer.stop()
; System.out.println("Time to count to 100000: "+timer.read()
+" seconds.");
Constructor Summary | |
---|---|
Clock()
Constructs a stopwatch for timing events to the milliseconds. |
Method Summary | |
---|---|
double |
read()
Read the value on the stop watch. |
void |
reset()
Resets the time on the clock to zero. |
void |
start()
Start the clock running. |
void |
stop()
Stop the clock. |
java.lang.String |
toString()
Generates string representation of clock. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Clock()
Method Detail |
---|
public void start()
public void stop()
public double read()
public void reset()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |