jvanzyl 00/12/19 22:17:38
Modified: src/java/org/apache/velocity/util Timer.java
Log:
- cleaning up javadoc, adding a bit of javadoc.
Revision Changes Path
1.3 +30 -23 jakarta-velocity/src/java/org/apache/velocity/util/Timer.java
Index: Timer.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/util/Timer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Timer.java 2000/12/04 04:24:34 1.2
+++ Timer.java 2000/12/20 06:17:37 1.3
@@ -60,16 +60,17 @@
import java.util.*;
/**
- A stopwatch class. Measures real time in milliseconds.
-*/
+ * A stopwatch class. Measures real time in milliseconds.
+ */
public class Timer
{
- Date startTime;
- double seconds;
- double totalSeconds;
-
- /**
- Creates a new timer. The timer does not start running until start is called.
+ Date startTime;
+ double seconds;
+ double totalSeconds;
+
+ /**
+ * Creates a new timer. The timer does not start running until
+ * start is called.
*/
public Timer()
{
@@ -77,26 +78,28 @@
}
/**
- Returns the time between start and stop. If the timer is running, it returns
- the time since start was called.
- */
+ * Returns the time between start and stop. If the timer is
+ * running, it returns the time since start was called.
+ */
public double getSeconds()
{
return seconds + calcTime();
}
/**
- Returns the total time spent running since the timer was created. Useful for
- aggregating several invocations of start & stop.
- */
+ * Returns the total time spent running since the timer was
+ * created. Useful for aggregating several invocations
+ * of start & stop.
+ */
public double getTotalSeconds()
{
return totalSeconds + calcTime();
}
/**
- Resets the timer. Both seconds and total seconds are cleared.
- */
+ * Resets the timer. Both seconds and total seconds
+ * are cleared.
+ */
public void reset()
{
startTime = null;
@@ -105,8 +108,8 @@
}
/**
- Starts the timer.
- */
+ * Starts the timer.
+ */
public void start()
{
if (timerRunning())
@@ -115,8 +118,8 @@
}
/**
- Stops the timer.
- */
+ * Stops the timer.
+ */
public void stop()
{
if (!timerRunning())
@@ -127,13 +130,17 @@
}
/**
- Returns true if the timer is running.
- */
+ * Returns true if the timer is running.
+ */
public boolean timerRunning()
{
return (startTime != null);
}
-
+
+ /**
+ * Return the duration the timer has run, value
+ * is returned in seconds.
+ */
double calcTime()
{
if (!timerRunning())