2004.04.29


com.jdc.dts
Class ElapsedTime

java.lang.Object
  |
  +--com.jdc.dts.ElapsedTime

public class ElapsedTime
extends Object

Class ElapsedTime represents the elapsed time between two events. Reference: http://www.javaworld.com/javaworld/jw-03-2001/jw-0330-time.html

Version:
1.0
Author:
Jay Damon

Constructor Summary
ElapsedTime()
          Constructs a new ElapsedTime object.
 
Method Summary
 void end()
          Ends, or stops, the elapsed timer.
 void end(Date date)
          Ends the elapsed timer for the specified date.
 int getDays()
          Returns the number of days in the elapsed time.
 int getHours()
          Returns the number of hours in the elapsed time.
 int getMillis()
          Returns the number of milliseconds in the elapsed time.
 int getMinutes()
          Returns the number of minutes in the elapsed time.
 int getSeconds()
          Returns the number of seconds in the elapsed time.
 long longValue()
          Returns the elapsed time in milliseconds.
static void main(String[] args)
          Executes the unit tests for the ElapsedTime class.
 void start()
          Starts the elapsed timer.
 void start(Date date)
          Starts the elapsed timer for the specified date..
 String toString()
          Returns a String representation of this ElapsedTime object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ElapsedTime

public ElapsedTime()
Constructs a new ElapsedTime object.

Method Detail

end

public void end()
Ends, or stops, the elapsed timer.


end

public void end(Date date)
Ends the elapsed timer for the specified date.


getDays

public int getDays()
Returns the number of days in the elapsed time.

Returns:
The number of days in the elapsed time.

getHours

public int getHours()
Returns the number of hours in the elapsed time.

Returns:
The number of hours in the elapsed time.

getMillis

public int getMillis()
Returns the number of milliseconds in the elapsed time.

Returns:
The number of milliseconds in the elapsed time.

getMinutes

public int getMinutes()
Returns the number of minutes in the elapsed time.

Returns:
The number of minutes in the elapsed time.

getSeconds

public int getSeconds()
Returns the number of seconds in the elapsed time.

Returns:
The number of seconds in the elapsed time.

longValue

public long longValue()
Returns the elapsed time in milliseconds. If the elapsed timer has not been ended, returns the elapsed time to the current point in time.

Returns:
The elapsed time in milliseconds.

start

public void start()
Starts the elapsed timer.


start

public void start(Date date)
Starts the elapsed timer for the specified date..


toString

public String toString()
Returns a String representation of this ElapsedTime object.

Overrides:
toString in class Object
Returns:
A String representation of this ElapsedTime object.

main

public static void main(String[] args)
Executes the unit tests for the ElapsedTime class.


2004.04.29



Copyright © 2004 J. Damon & Co.; All Rights Reserved WorldWide.