|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--javax.realtime.HighResolutionTime
|
+--javax.realtime.RelativeTime
An object that represents a time interval millis/1E3+nanos/1E9 seconds long. It generally is used to represent a time relative to now.
If the value of any of the millisecond or nanosecond fields is negative the
variable is set to negative value. Although logically
this may represent time before the epoch, invalid results may occur if
an instance of RelativeTime representing time before the epoch is given as a
parameter to the a method. For add and subtract negative
values behave just like they do in arithmetic.
Caution: This class is explicitly unsafe in multithreaded situations when it is being changed. No synchronization is done. It is assumed that users of this class who are mutating instances will be doing their own synchronization at a higher level.
| Constructor Summary | |
RelativeTime()
Equivalent to new RelativeTime(0,0) |
|
RelativeTime(long millis,
int nanos)
Construct a RelativeTime object which means a time millis milliseconds plus nanos nanoseconds past the Clock time. |
|
RelativeTime(RelativeTime time)
Make a new RelativeTime object from the given RelativeTime object |
|
| Method Summary | |
AbsoluteTime |
absolute(Clock clock)
Convert this time to an absolute time, relative to some clock. |
AbsoluteTime |
absolute(Clock clock,
AbsoluteTime destination)
Convert this time to an absolute time. |
RelativeTime |
add(long millis,
int nanos)
Add a specific number of milli and nano seconds to this. |
RelativeTime |
add(long millis,
int nanos,
RelativeTime destination)
Add a specific number of milli and nano seconds to this. |
RelativeTime |
add(RelativeTime time)
Return this + time. |
RelativeTime |
add(RelativeTime time,
RelativeTime destination)
Return this + time. |
void |
addInterarrivalTo(AbsoluteTime destination)
Add this time to an AbsoluteTime. |
RelativeTime |
getInterarrivalTime()
Return the interarrival time that is the result of dividing this interval by its frequency. |
RelativeTime |
getInterarrivalTime(RelativeTime destination)
Return the interarrival time that is the result of dividing this interval by its frequency. |
RelativeTime |
relative(Clock clock)
Change the association of this from the currently associated clock to the given clock. |
RelativeTime |
relative(Clock clock,
RelativeTime destination)
Set the time of this to the time of the given instance of RelativeTime with respect to the given instance of
Clock. |
RelativeTime |
subtract(RelativeTime time)
|
RelativeTime |
subtract(RelativeTime time,
RelativeTime destination)
|
java.lang.String |
toString()
Return a printable version of this time. |
| Methods inherited from class javax.realtime.HighResolutionTime |
compareTo, compareTo, equals, equals, getMilliseconds, getNanoseconds, hashCode, relative, set, set, set, waitForObject |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public RelativeTime()
public RelativeTime(long millis,
int nanos)
millis - The milliseconds component of the time past the Clock timenanos - The nanoseconds component of the time past the Clock timepublic RelativeTime(RelativeTime time)
time - The RelativeTime object used as the source for the copy| Method Detail |
public AbsoluteTime absolute(Clock clock,
AbsoluteTime destination)
absolute in class HighResolutionTimeclock - if null, Clock.getRealTimeClock() is useddestination - public AbsoluteTime absolute(Clock clock)
HighResolutionTimeabsolute in class HighResolutionTimejavax.realtime.HighResolutionTimeclock - This clock is used to convert this time into absolute time.public RelativeTime relative(Clock clock)
relative in class HighResolutionTime
public RelativeTime relative(Clock clock,
RelativeTime destination)
RelativeTime with respect to the given instance of
Clock.
public RelativeTime add(long millis,
int nanos)
this.
A new object is allocatedmillis - milli seconds to addnanos - nano seconds to add
public RelativeTime add(long millis,
int nanos,
RelativeTime destination)
this.
A new object is allocated if destination is null, otherwise store there.millis - milli seconds to addnanos - nano seconds to adddestination - to store the resultpublic final RelativeTime add(RelativeTime time)
time - the time to add to this
public RelativeTime add(RelativeTime time,
RelativeTime destination)
time - the time to add to thisdestination - to place the result inpublic void addInterarrivalTo(AbsoluteTime destination)
destination - public RelativeTime getInterarrivalTime()
RelativeTime, and
RationalTimes with a frequency of 1, it just returns this.
The interarrival time is necessarily an approximation.public RelativeTime getInterarrivalTime(RelativeTime destination)
RelativeTime, or a RationalTime with a frequency of 1
it just returns this. The interarrival time is necessarily an approximation.destination - interarrival time is between this and the destinationpublic final RelativeTime subtract(RelativeTime time)
time - relative time to subtract from this
public RelativeTime subtract(RelativeTime time,
RelativeTime destination)
time - relative time to subtract from thisdestination - place to store the result. New object allocated if nullpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||