|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.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.
Field Summary |
Fields inherited from class javax.realtime.HighResolutionTime |
millis, nanos |
Constructor Summary | |
RelativeTime()
Equivalent to new RelativeTime(0,0). |
|
RelativeTime(long millis,
int nanos)
Construct a new RelativeTime object from the given millisecond and nanosecond components. |
|
RelativeTime(RelativeTime relativeTime)
Construct a new RelativeTime object from the given RelativeTime. |
Method Summary | |
AbsoluteTime |
absolute(Clock clock)
Convert this time to an absolute time, relative to some clock. |
void |
absolute(Clock clock,
AbsoluteTime dest)
Convert this time to an absolute time, relative to some clock. |
RelativeTime |
add(long millis,
int nanos)
Add a specific number of milli and nano seconds to this . |
void |
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. |
void |
add(RelativeTime time,
RelativeTime dest)
Return this + time. |
void |
decrement(RelativeTime time)
Increment this time by a given amount. |
void |
increment(RelativeTime time)
Increments this time, by a given ammount. |
RelativeTime |
subtract(RelativeTime time)
Computes the diffenrence (this - time). |
void |
subtract(RelativeTime time,
RelativeTime destination)
Computes the diffenrence (this - time). |
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
- a long
value specifing the seconds
componentsnanos
- an int
value specifing the nano
seconds componenetpublic RelativeTime(RelativeTime relativeTime)
relativeTime
- a RelativeTime
value from
which the time for this object will be takenMethod Detail |
public AbsoluteTime absolute(Clock clock)
clock
- The clock is used to convert this time into
absolute time.
public void absolute(Clock clock, AbsoluteTime dest)
clock
- The clock is used to convert this time into
absolute time.dest
- the destination for the computed absolute time.public final RelativeTime add(RelativeTime time)
time
- -the time to add to this.
public void add(RelativeTime time, RelativeTime dest)
time
- the time to add to this.dest
- where the result should be placed.public RelativeTime add(long millis, int nanos)
millis
- milli seconds to add.nanos
- nano seconds to add.
public void add(long millis, int nanos, RelativeTime destination)
millis
- milli seconds to add.nanos
- nano seconds to add.destination
- the destination were to store the result.public final RelativeTime subtract(RelativeTime time)
time
- relative time to subtract from this.
public final void subtract(RelativeTime time, RelativeTime destination)
time
- relative time to subtract from this.destination
- the destination object that will hold the result.public void increment(RelativeTime time)
time
- the increment represented by a a
RelativeTime
valuepublic void decrement(RelativeTime time)
time
- the decrement represented by a a
RelativeTime
value.public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |