|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | 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 (Jenuary 1, 1970,
00:00:00 GMT). This representation was designed to be compatible
with the standard Java representation of an absolute time in the
java.util.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 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 | |
static javax.realtime.AbsoluteTime |
endOfDays
|
Fields inherited from class javax.realtime.HighResolutionTime |
defaultClock |
Constructor Summary | |
AbsoluteTime()
Equal to new AbsoluteTime(0,0) . |
|
AbsoluteTime(javax.realtime.AbsoluteTime t)
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 | |
javax.realtime.AbsoluteTime |
absolute(javax.realtime.Clock clock)
Convert time given by this to an absolute time relative
to a given clock. |
javax.realtime.AbsoluteTime |
absolute(javax.realtime.Clock clock,
javax.realtime.AbsoluteTime destination)
Convert this time to an absolute time. |
javax.realtime.AbsoluteTime |
add(long millis,
int nanos)
Add millis and nanos to this . |
javax.realtime.AbsoluteTime |
add(long millis,
int nanos,
javax.realtime.AbsoluteTime destination)
Add millis and nanos to this . |
javax.realtime.AbsoluteTime |
add(javax.realtime.RelativeTime time)
Add the time given by the parameter to this . |
javax.realtime.AbsoluteTime |
add(javax.realtime.RelativeTime time,
javax.realtime.AbsoluteTime destination)
Add the time given by the parameter to this . |
java.util.Date |
getDate()
Convert the time given by this to a java.utilDate
format. |
javax.realtime.RelativeTime |
relative(javax.realtime.Clock clock)
Create a RelativeTime object with current time given by
this with reference to the parameter. |
javax.realtime.RelativeTime |
relative(javax.realtime.Clock clock,
javax.realtime.AbsoluteTime destination)
Create a RelativeTime object with current time given by
this with reference to Clock parameter. |
javax.realtime.RelativeTime |
relative(javax.realtime.Clock clock,
javax.realtime.HighResolutionTime time)
Create a RelativeTime object with current time given by
this with reference to Clock parameter. |
void |
set(java.util.Date d)
Change the time represented by this to that given by the parameter. |
javax.realtime.RelativeTime |
subtract(javax.realtime.AbsoluteTime time)
Finds the difference between the time given by this and the time
given by the parameter. |
javax.realtime.RelativeTime |
subtract(javax.realtime.AbsoluteTime time,
javax.realtime.RelativeTime destination)
Finds the difference between the time given by this and the time
given by the parameter. |
javax.realtime.AbsoluteTime |
subtract(javax.realtime.RelativeTime time)
Finds the difference between the time given by this and the time
given by the parameter. |
javax.realtime.AbsoluteTime |
subtract(javax.realtime.RelativeTime time,
javax.realtime.AbsoluteTime destination)
Finds the difference between the time given by this and the time
given by the parameter. |
java.lang.String |
toString()
Create a printable string of the time given by this , in a format
that matches java.util.Date.toString() with a postfix to the
detail the nanosecond value. |
Methods inherited from class javax.realtime.HighResolutionTime |
compareTo, compareTo, equals, equals, getMilliseconds, getNanoseconds, hashCode, set, set, set, time, waitForObject |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static javax.realtime.AbsoluteTime endOfDays
Constructor Detail |
public AbsoluteTime()
AbsoluteTime(0,0)
.
public AbsoluteTime(javax.realtime.AbsoluteTime t)
AbsoluteTime
object from the given
AbsoluteTime
object.
public AbsoluteTime(java.util.Date date)
new AbsoluteTime(date.getTime(), 0)
.
date
- The java.util.Date
representation of the time
past the epoch.public AbsoluteTime(long millis, int nanos)
AbsoluteTime
object which means a time
millis
milliseconds plus nanos
nanoseconds
past 00:00:00 GMT on January 1, 1970.
millis
- The milliseconds component of the time past the epoch.nanos
- The nanosecond component of the time past the epoch.Method Detail |
public javax.realtime.AbsoluteTime absolute(javax.realtime.Clock clock)
this
to an absolute time relative
to a given clock.
absolute
in class HighResolutionTime
clock
- The clock on which this
will be based.
this
.public javax.realtime.AbsoluteTime absolute(javax.realtime.Clock clock, javax.realtime.AbsoluteTime destination)
AbsoluteTime
,
this is really easy: it just return itself. Presumes that this is already
relative to the given clock.
absolute
in class HighResolutionTime
clock
- The clock on which this is based.destination
- Converted to an absolute time.
this
.public javax.realtime.AbsoluteTime add(long millis, int nanos)
millis
and nanos
to this
. A new
object is allocated for the result.
millis
- The number of milliseconds to be added to this
.nanos
- The number of nanoseconds to be added to this
.
AbsoluteTime
object whose time is this
plus millis
and nanos
.public javax.realtime.AbsoluteTime add(long millis, int nanos, javax.realtime.AbsoluteTime destination)
millis
and nanos
to this
. If the
destination
is non-null, the result is placed there and returned.
Otherwise, a new object is allocated for the result.
millis
- The number of milliseconds to be added to this
.nanos
- The number of nanoseconds to be added to this
.destination
- A reference to an AbsoluteTime
object into
which the result of the addition may be placed.public final javax.realtime.AbsoluteTime add(javax.realtime.RelativeTime time)
this
.
time
- The time to add to this
.
this
.public javax.realtime.AbsoluteTime add(javax.realtime.RelativeTime time, javax.realtime.AbsoluteTime destination)
this
. If the
destination
is non-null, the result is placed there
and returned. Otherwise, a new object is allocated for the result.
time
- The time to add to this
.destination
- A reference to an AbsoluteTime
object
into which the result of the addition may be placed.
destination
or a new object whose
time is this
plus millisnano
.public java.util.Date getDate()
this
to a java.utilDate
format. Note that java.util.Date
represents time as milliseconds
so the nanoseconds of this
will be lost.
java.util.Date
object with a value of
the time past the epoch represented by this
.public javax.realtime.RelativeTime relative(javax.realtime.Clock clock)
RelativeTime
object with current time given by
this
with reference to the parameter.
relative
in class HighResolutionTime
clock
- The clock reference used as a reference for this.
RelativeTime
object whose time is
set to the time given by this
referencing the parameter.public javax.realtime.RelativeTime relative(javax.realtime.Clock clock, javax.realtime.AbsoluteTime destination)
RelativeTime
object with current time given by
this
with reference to Clock
parameter. If the
destination
is non-null, the result is placed there and
returned. Otherwise, a new object is allocated for the result
clock
- The clock reference used as a reference for this.destination
- A reference to a RelativeTime
object into
which the result of the subtraction may be placed.
RelativeTime
object whose time is
set to the time given by this
referencing the parameter.public javax.realtime.RelativeTime relative(javax.realtime.Clock clock, javax.realtime.HighResolutionTime time)
RelativeTime
object with current time given by
this
with reference to Clock
parameter. If the
destination
is non-null, the result is placed there and
returned. Otherwise, a new object is allocated for the result
relative
in class HighResolutionTime
clock
- The clock reference used as a reference for this.time
- A reference to a HighResolutionTime
object into
which the result of the subtraction may be placed.
RelativeTime
object whose time is
set to the time given by this
referencing the parameter.public void set(java.util.Date d)
this
to that given by the parameter.
public final javax.realtime.RelativeTime subtract(javax.realtime.AbsoluteTime time)
this
and the time
given by the parameter. The difference is, of course, a RelativeTime
.
time
- A reference to an AbsoluteTime
object whose time is
subtracted from this
.
RelativeTime
object whose time is the
difference.public javax.realtime.RelativeTime subtract(javax.realtime.AbsoluteTime time, javax.realtime.RelativeTime destination)
this
and the time
given by the parameter. The difference is, of course, a RelativeTime
.
If the destination
is non-null, the result is placed there and
returned. Otherwise, a new object is allocated for the result.
time
- A reference to an AbsoluteTime
object whose time is
subtracted from this
.destination
- A reference to an RelativeTime
object into which
the result of the addition may be placed.
RelativeTime
object whose time is the
difference between this
and the time
paramter.public final javax.realtime.AbsoluteTime subtract(javax.realtime.RelativeTime time)
this
and the time
given by the parameter.
time
- A reference to an AbsoluteTime
object whose time is
subtracted from this
.
AbsoluteTime
object whose time is the
difference.public javax.realtime.AbsoluteTime subtract(javax.realtime.RelativeTime time, javax.realtime.AbsoluteTime destination)
this
and the time
given by the parameter. The difference is, of course, a RelativeTime
.
If the destination
is non-null, the result is placed there and
returned. Otherwise, a new object is allocated for the result.
time
- A reference to an AbsoluteTime
object whose time is
subtracted from this
.destination
- A reference to an AbsoluteTime
object into which
the result of the addition may be placed.
AbsoluteTime
object whose time is the
difference between this
and time
parameter.public java.lang.String toString()
this
, in a format
that matches java.util.Date.toString()
with a postfix to the
detail the nanosecond value.
toString
in class java.lang.Object
this
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |