atropos.lp
Class AvnmpTime

java.lang.Object
  |
  +--java.util.Date
        |
        +--atropos.lp.AvnmpTime
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, java.io.Serializable
Direct Known Subclasses:
AvnmpDebug

public class AvnmpTime
extends java.util.Date
implements java.io.Serializable

This class handles AVNMP Time calculation. There are two types of time: relative and absolute. Relative time is the amount of wall-clock time which has elapsed since the object was created. Absolute time is simply using this object to hold time values which need to be explicitly set and manipulated.

This research is funded by DARPA/ITO Contract Number: F30602-98-C-0230 supported by the Air Force Research Laboratory/IF.

Version:
$Revision: 1.1.1.1 $ $State: Exp $
Author:
Steve Bush
See Also:
Serialized Form

Constructor Summary
AvnmpTime()
          Construct a relative time object.
AvnmpTime(long t)
          Construct an absolute time object.
 
Method Summary
 long add(long t)
          Return the sum between of this time and the input: input_time + this_time.
 AvnmpTime adjustRelative(long t)
          Adjust the time this variable was created by a given amount.
 long diff(long t)
          Return the difference between this time and the input: input_time - this_time.
 long now()
          The current time.
 void resetRelative()
          Reset the start time of this object to the present time.
 long set(long t)
          Set the time to the given input.
 long startTime()
          Display the time this variable was created.
 long time()
          Return the time relative to the start time.
 java.lang.String toString()
          Display this object as a string.
 
Methods inherited from class java.util.Date
after, before, clone, compareTo, compareTo, equals, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toLocaleString, UTC
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AvnmpTime

public AvnmpTime(long t)
Construct an absolute time object. There are two types of time: relative and absolute. Relative time is the amount of wall-clock time which has elapsed since the object was created. Absolute time is simply using this object to hold time values which need to be explicitly set and manipulated.

AvnmpTime

public AvnmpTime()
Construct a relative time object. There are two types of time: relative and absolute. Relative time is the amount of wall-clock time which has elapsed since the object was created. Absolute time is simply using this object to hold time values which need to be explicitly set and manipulated.
Method Detail

toString

public java.lang.String toString()
Display this object as a string.
Overrides:
toString in class java.util.Date
Returns:
A string representation of the time in milliseconds.

startTime

public long startTime()
Display the time this variable was created. For debugging to get the difference between host clocks.

now

public long now()
The current time.
Returns:
The current time.

adjustRelative

public AvnmpTime adjustRelative(long t)
Adjust the time this variable was created by a given amount. This is used to account for differences in time between host clocks.
Parameters:
t - An adjustment amount which is added to the creation time of this object.
Returns:
This object; thus this method can be used with the contructor for this object.

time

public long time()
Return the time relative to the start time.
Returns:
Time in milliseconds.

diff

public long diff(long t)
Return the difference between this time and the input: input_time - this_time.
Parameters:
t - Input time
Returns:
This time subtracted from the input time.

add

public long add(long t)
Return the sum between of this time and the input: input_time + this_time.
Parameters:
t - Input time
Returns:
This time added to the input time.

set

public long set(long t)
Set the time to the given input.
Parameters:
t - The to set.
Returns:
The time.

resetRelative

public void resetRelative()
Reset the start time of this object to the present time.


Copyright © 2002 GE Corporate Research and Development. All Rights Reserved.