|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.realtime.HighResolutionTime | +--javax.realtime.AbsoluteTime
An object that represents a specific point in time given by
milliseconds plus nanoseconds past the epoch
(January 1, 1970, 00:00:00 GMT).
This representation was designed to be compatible with
the standard Java representation of an absolute time in the
Date
class.
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 AbsoluteTime
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 | |
AbsoluteTime()
Equal to new AbsoluteTime(0,0). |
|
AbsoluteTime(AbsoluteTime time)
Make a new AbsoluteTime object from the given AbsoluteTime object. |
|
AbsoluteTime(java.util.Date date)
Equivalent to new AbsoluteTime (date.getTime(),0) |
|
AbsoluteTime(long millis,
int nanos)
Construct an AbsoluteTime object which means a time millis milliseconds plus nanos nanoseconds past 00:00:00 GMT on January 1, 1970. |
Method Summary | |
AbsoluteTime |
absolute(Clock clock)
Convert this time to an absolute time relative to a given clock. |
AbsoluteTime |
absolute(Clock clock,
AbsoluteTime destination)
Convert this time to an absolute time. |
AbsoluteTime |
add(long millis,
int nanos)
Add millis and nanos to this. |
AbsoluteTime |
add(long millis,
int nanos,
AbsoluteTime destination)
If a destination is non-null, the result is placed there and the destination is returned. |
AbsoluteTime |
add(RelativeTime time)
Return this + time. |
AbsoluteTime |
add(RelativeTime time,
AbsoluteTime destination)
Return this + time. |
java.util.Date |
getDate()
|
RelativeTime |
relative(Clock clock)
Change the association of this from the currently associated clock to the given clock. |
RelativeTime |
relative(Clock clock,
AbsoluteTime destination)
Convert the given instance of RelativeTime to an instance
of RelativeTime relative to the given instance of Clock . |
void |
set(java.util.Date date)
Change the time represented by this. |
RelativeTime |
subtract(AbsoluteTime time)
|
RelativeTime |
subtract(AbsoluteTime time,
RelativeTime destination)
|
AbsoluteTime |
subtract(RelativeTime time)
|
AbsoluteTime |
subtract(RelativeTime time,
AbsoluteTime destination)
|
java.lang.String |
toString()
Return a printable version of this time, in a format that matches java.util.Date.toString() with a postfix to the detail the sub-second value |
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 AbsoluteTime()
public AbsoluteTime(AbsoluteTime time)
AbsoluteTime
object from the given AbsoluteTime
object.time
- The AbsoluteTime
object as the source for the copy.public AbsoluteTime(java.util.Date date)
date
- The java.util.Data representation of the time past the epochpublic AbsoluteTime(long millis, int nanos)
millis
- The milliseconds component of the time past the epochnanos
- The nanosecond component of the time past the epochMethod Detail |
public AbsoluteTime absolute(Clock clock, AbsoluteTime destination)
absolute
in class HighResolutionTime
clock
- Clock on which this is baseddestination
- Converted to an absolute timepublic AbsoluteTime absolute(Clock clock)
absolute
in class HighResolutionTime
clock
- Clock on which this is basedpublic AbsoluteTime add(long millis, int nanos)
millis
- the milliseconds value to be added to thisnanos
- the nanoseconds value to be added to thispublic AbsoluteTime add(long millis, int nanos, AbsoluteTime destination)
millis
- millisecondsnanos
- nanosecondspublic final AbsoluteTime add(RelativeTime time)
time
- the time to add to this
public AbsoluteTime add(RelativeTime time, AbsoluteTime destination)
time
- the time to add to this
destination
- to place the result inpublic java.util.Date getDate()
public void set(java.util.Date date)
date
- java.util.Date which becomes the time represented by this
after the completion of this method.public final RelativeTime subtract(AbsoluteTime time)
time
- absolute time to subtract from this
public final RelativeTime subtract(AbsoluteTime time, RelativeTime destination)
time
- absolute time to subtract from this
destination
- place to store the result. New object allocated if nullpublic final AbsoluteTime subtract(RelativeTime time)
time
- relative time to subtract from this
public AbsoluteTime subtract(RelativeTime time, AbsoluteTime destination)
time
- relative time to subtract from this
destination
- place to store the result. New object allocated if nullpublic java.lang.String toString()
toString
in class java.lang.Object
public RelativeTime relative(Clock clock)
relative
in class HighResolutionTime
public RelativeTime relative(Clock clock, AbsoluteTime destination)
RelativeTime
to an instance
of RelativeTime
relative to the given instance of Clock
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |