public class AbsoluteTime extends HighResolutionTime<AbsoluteTime>
Jamaica Real-Time Specification for Java class AbsoluteTime.
This class represents an absolute point in the time represented by a Clock.
Constructor and Description |
---|
AbsoluteTime()
Constructor to create absolute time 0ms, 0ns.
|
AbsoluteTime(AbsoluteTime time)
Constructor to create an absolute time with millis and nanos
taken from an existing absolute time.
|
AbsoluteTime(AbsoluteTime time,
Clock clock)
Constructor to create an absolute time with millis and nanos
taken from an existing absolute time.
|
AbsoluteTime(Clock clock)
Constructor to create absolute time 0ms, 0ns with given clock
association.
|
AbsoluteTime(Date date)
Constructor to create an absolute time from a time represented by
an instance of Date.
|
AbsoluteTime(Date date,
Clock clock)
Constructor to create an absolute time from a time represented by
an instance of Date.
|
AbsoluteTime(long millis,
int nanos)
Constructor to create an absolute time from given milli and nano
seconds.
|
AbsoluteTime(long millis,
int nanos,
Clock clock)
Constructor to create an absolute time from given milli and nano
seconds.
|
Modifier and Type | Method and Description |
---|---|
AbsoluteTime |
absolute(Clock clock)
absolute implements abstract method inherited from
HighResolutionTime.
|
AbsoluteTime |
absolute(Clock clock,
AbsoluteTime dest)
absolute implements abstract method inherited from
HighResolutionTime.
|
AbsoluteTime |
add(long millis,
int nanos)
add adds time given in milliseconds and nanoseconds to this
absolute time.
|
AbsoluteTime |
add(long millis,
int nanos,
AbsoluteTime dest)
add adds time given in milliseconds and nanoseconds to this
absolute time.
|
AbsoluteTime |
add(RelativeTime time)
add adds interval given as RelativeTime instance to this
absolute time.
|
AbsoluteTime |
add(RelativeTime time,
AbsoluteTime dest)
add adds interval given as RelativeTime instance to this absolute
time.
|
Date |
getDate()
getDate converts this absolute time to an instance of Date that
represents the same time.
|
RelativeTime |
relative(Clock clock)
relative implements abstract method inherited from
HighResolutionTime.
|
RelativeTime |
relative(Clock clock,
RelativeTime dest)
relative implements abstract method inherited from
HighResolutionTime.
|
AbsoluteTime |
set(Date date)
set sets the time represented by this to the time represented by
an instance of Date.
|
RelativeTime |
subtract(AbsoluteTime time)
subtract subtracts another absolute time from this absolute
time.
|
RelativeTime |
subtract(AbsoluteTime time,
RelativeTime dest)
subtract subtracts another absolute time from this absolute
time.
|
AbsoluteTime |
subtract(RelativeTime time)
subtract subtracts an interval given as an instance of
RelativeTime from this.
|
AbsoluteTime |
subtract(RelativeTime time,
AbsoluteTime dest)
subtract subtracts an interval given as an instance of
RelativeTime from this.
|
String |
toString()
Creates a printable string of the time given by
this . |
clone, compareTo, equals, equals, getClock, getMilliseconds, getNanoseconds, hashCode, set, set, set, waitForObject
public AbsoluteTime()
public AbsoluteTime(AbsoluteTime time)
time
- the original absolute time, must not be null.public AbsoluteTime(Date date)
Note, the usage of the present method may introduce some drifting time effects. In fact, two AbsolutTime objects constructed with an identical date parameter potentially reflecting different points in time.
date
- the original Date, must not be null.public AbsoluteTime(long millis, int nanos)
ensure
(this.getMilliseconds() == millis, this.getNanosecondes() == nanos);
millis
- the milliseconds value for the new absolute time.nanos
- the nanoseconds value for the new absolute time.public AbsoluteTime(Clock clock)
clock
- the clock to be associated with this time,
Clock.getRealtimeClock if null.public AbsoluteTime(AbsoluteTime time, Clock clock)
time
- the original absolute time, must not be null.clock
- the clock to be associated with this time,
Clock.getRealtimeClock if null.public AbsoluteTime(Date date, Clock clock)
Note, the usage of the present method may introduce some drifting time effects. In fact, two AbsolutTime objects constructed with an identical date parameter potentially reflect different points in time.
date
- the original Date, must not be null.clock
- the clock to be associated with this time,
Clock.getRealtimeClock if null.public AbsoluteTime(long millis, int nanos, Clock clock)
ensure
(this.getMilliseconds() == millis, this.getNanosecondes() == nanos);
millis
- the milliseconds value for the new absolute time.nanos
- the nanoseconds value for the new absolute time.clock
- the clock to be associated with this time,
Clock.getRealtimeClock if null.public AbsoluteTime absolute(Clock clock, AbsoluteTime dest)
For AbsoluteTime, the result is this iff dest is null.
absolute
in class HighResolutionTime<AbsoluteTime>
clock
- The clock the result should be relative to, the realtime
clock is considered iff it is null.dest
- The preallocated AbsoluteTime object to hold the
result. May be null to indicate that a new object should be
allocated.public AbsoluteTime absolute(Clock clock)
For AbsoluteTime, no conversion into AbsoluteTime is needed in this case.
absolute
in class HighResolutionTime<AbsoluteTime>
clock
- The clock the result should be relative to. When clock is
null the association is made with the default realtime clock.public AbsoluteTime add(long millis, int nanos)
millis
- the milliseconds part of the interval to be added.nanos
- the nanoseconds part of the interval to be added.public AbsoluteTime add(long millis, int nanos, AbsoluteTime dest)
millis
- the milliseconds part of the interval to be added.nanos
- the nanoseconds part of the interval to be added.dest
- The preallocated AbsoluteTime object to hold the
result. May be null to indicate that a new object should be
allocated.public AbsoluteTime add(RelativeTime time)
time
- the interval to be addedpublic AbsoluteTime add(RelativeTime time, AbsoluteTime dest)
time
- the interval to be addeddest
- The preallocated AbsoluteTime object to hold the
result. May be null to indicate that a new object should be
allocated.public Date getDate()
public AbsoluteTime set(Date date)
Note, the usage of the present method may introduce some
drifting time effects. As a consequence, the equality is not assured
between the results of getDate()
calls on two
AbsoluteTime
objects with the same date.
date
- an instance of Date, must not be null.public RelativeTime subtract(AbsoluteTime time)
time
- the other absolute time.public RelativeTime subtract(AbsoluteTime time, RelativeTime dest)
time
- the other absolute time.dest
- The preallocated RelativeTime object to hold the
result. May be null to indicate that a new object should be
allocated.public AbsoluteTime subtract(RelativeTime time)
time
- the interval to be subtracted.public AbsoluteTime subtract(RelativeTime time, AbsoluteTime dest)
time
- the interval to be subtracted.dest
- The preallocated RelativeTime object to hold the
result. May be null to indicate that a new object should be
allocated.public String toString()
this
.
The string shall be a decimal representation of the milliseconds and nanosecond values; formatted as follows "(2251 ms, 750000 ns)"
public RelativeTime relative(Clock clock)
relative
in class HighResolutionTime<AbsoluteTime>
clock
- The clock the result should be relative to.public RelativeTime relative(Clock clock, RelativeTime dest)
relative
in class HighResolutionTime<AbsoluteTime>
clock
- The clock the result should be relative to.dest
- The preallocated RelativeTime object to hold the
result. May be null to indicate that a new object should be
allocated.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2019 aicas GmbH. All Rights Reserved.