org.jagatoo.util.timing
Class Time

java.lang.Object
  extended by org.jagatoo.util.timing.Time

public class Time
extends java.lang.Object

Represents a Timestamp in the desired units. Also handles conversions.


Field Summary
static double DAY
           
static double HOUR
           
static double MICROSECOND
           
static double MILLISECOND
           
static double MINUTE
           
static double MONTH
           
static double NANOSECOND
           
static double SECOND
           
static double WEEK
           
static double YEAR
           
 
Constructor Summary
Time(double value, double unit)
          Create a new timestamp
 
Method Summary
 Time convertTo(double newUnit)
           
 double getMilliseconds()
           
 double getUnit()
           
 double getValue()
           
 void setValue(double value)
          Set the value of this timestamp, in the unit specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NANOSECOND

public static final double NANOSECOND
See Also:
Constant Field Values

MICROSECOND

public static final double MICROSECOND
See Also:
Constant Field Values

MILLISECOND

public static final double MILLISECOND
See Also:
Constant Field Values

SECOND

public static final double SECOND
See Also:
Constant Field Values

MINUTE

public static final double MINUTE
See Also:
Constant Field Values

HOUR

public static final double HOUR
See Also:
Constant Field Values

DAY

public static final double DAY
See Also:
Constant Field Values

WEEK

public static final double WEEK
See Also:
Constant Field Values

MONTH

public static final double MONTH
See Also:
Constant Field Values

YEAR

public static final double YEAR
See Also:
Constant Field Values
Constructor Detail

Time

public Time(double value,
            double unit)
Create a new timestamp

Parameters:
value - The value of the timestamp
unit - The unit of the time stamp, e.g. TimeStamp.NANOSECOND, TimeStamp.MICROSECOND, TimeStamp.MILLISECOND, TimeStamp.SECOND
Method Detail

getValue

public double getValue()
Returns:
the value of this timestamp, in the unit specified.
See Also:
getUnit()

setValue

public void setValue(double value)
Set the value of this timestamp, in the unit specified.

Parameters:
value -

getMilliseconds

public double getMilliseconds()
Returns:
the number of milliseconds this TimeStamp represents.

getUnit

public double getUnit()
Returns:
the unit of this timestamp, = the number of milliseconds ONE unit represents.

convertTo

public Time convertTo(double newUnit)
Returns:
the converted value to the new unit