|
|||||||
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. 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. All Implemented Interfaces: java.lang.Comparable Direct Known Subclasses: RationalTime
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)
|
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)
The purpose of "destination" is unclear, for the result is returned anyway. |
void |
addInterarrivalTo(AbsoluteTime destination)
Add this time to an AbsoluteTime. |
RelativeTime |
getInterarrivalTime(RelativeTime destination)
Return the interarrival time that is the result of dividing this interval by its frequency. |
RelativeTime |
relative(Clock clock)
|
RelativeTime |
relative(Clock clock,
RelativeTime destination)
|
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,
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 copyMethod Detail |
public AbsoluteTime absolute(Clock clock, AbsoluteTime destination)
clock
- if null, Clock.getRealTimeClock() is useddestination
- public AbsoluteTime absolute(Clock clock)
public RelativeTime relative(Clock clock)
public RelativeTime relative(Clock clock, RelativeTime destination)
public RelativeTime add(long millis, int nanos)
this
.
A new object is allocatedmillis
- milli seconds to addnanos
- nano seconds to addpublic 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 this
destination
- to place the result inpublic void addInterarrivalTo(AbsoluteTime destination)
destination
- 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 this
destination
- place to store the result. New object allocated if nullpublic java.lang.String toString()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |