@Deprecated public class RationalTime extends RelativeTime
Caution: This class is explicitly unsafe for multithreading when being changed. Code that mutates instances of this class should synchronize at a higher level.
Constructor and Description |
---|
RationalTime(int frequency)
Deprecated.
Constructs an instance of
RationalTime . |
RationalTime(int frequency,
long millis,
int nanos)
Deprecated.
Constructs an instance of
RationalTime . |
RationalTime(int frequency,
RelativeTime interval)
Deprecated.
Constructs an instance of
RationalTime from the given
RelativeTime . |
Modifier and Type | Method and Description |
---|---|
AbsoluteTime |
absolute(Clock clock,
AbsoluteTime destination)
Deprecated.
Converts time of
this to an absolute time. |
void |
addInterarrivalTo(AbsoluteTime destination)
Deprecated.
Adds the time of
this to an AbsoluteTime
It is almost the same dest.add(this, dest) except
that it accounts for (i.e. |
int |
getFrequency()
Deprecated.
Gets the value of
frequency . |
RelativeTime |
getInterarrivalTime()
Deprecated.
Gets the interarrival time.
|
RelativeTime |
getInterarrivalTime(RelativeTime dest)
Deprecated.
Gets the interarrival time.
|
RationalTime |
set(long millis,
int nanos)
Deprecated.
Sets the indicated fields to the given values.
|
void |
setFrequency(int frequency)
Deprecated.
Sets the value of the
frequency field. |
java.lang.String |
toString()
Deprecated.
Creates a printable string of the time given by
this . |
absolute, absolute, absolute, add, add, add, add, apportion, apportion, compareToZero, multiply, negate, negate, relative, relative, relative, relative, scale, scale, subtract, subtract
clone, compareTo, equals, equals, getChronograph, getClock, getMilliseconds, getNanoseconds, hashCode, set, set, set, waitForObject
public RationalTime(int frequency, long millis, int nanos)
RationalTime
.
All arguments must be greater than or equal to zero.frequency
- The frequency value.millis
- The milliseconds value.nanos
- The nanoseconds value.java.lang.IllegalArgumentException
- when any of the argument values are
less than zero, or when frequency
is equal to zero.public RationalTime(int frequency, RelativeTime interval)
RationalTime
from the given
RelativeTime
.frequency
- The frequency value.interval
- The given instance of RelativeTime
.java.lang.IllegalArgumentException
- when either of the argument values
are less than zero, or when frequency
is equal to zero.public RationalTime(int frequency)
RationalTime
. Equivalent to
new RationalTime(1000, 0, frequency)
—essentially
a cycles-per-second value.java.lang.IllegalArgumentException
- when frequency
is
less than or equal to zero.public AbsoluteTime absolute(Clock clock, AbsoluteTime destination)
this
to an absolute time.absolute
in class RelativeTime
clock
- The reference clock. When null
,
Clock.getRealTimeClock()
is used.destination
- A reference to the destination instance.AbsoluteTime
conversion in
dest
when dest
is not null
,
otherwise the result is returned in a newly allocated object.
The result is associated with the clock
parameter.public void addInterarrivalTo(AbsoluteTime destination)
this
to an AbsoluteTime
It is almost the same dest.add(this, dest)
except
that it accounts for (i.e. divides by) the frequency.addInterarrivalTo
in class RelativeTime
destination
- A reference to the destination instance.public int getFrequency()
frequency
.frequency
as an integer.public RelativeTime getInterarrivalTime()
(milliseconds/103 +
nanoseconds/109)/frequency
rounded down to the
nearest expressible value of the fields and their types of
RelativeTime
.getInterarrivalTime
in class RelativeTime
public RelativeTime getInterarrivalTime(RelativeTime dest)
(milliseconds / 10<sup>3</sup> + nanoseconds / 10<sup>9</sup>) / frequency
rounded down to the nearest expressible value of the fields and
their types of RelativeTime
.getInterarrivalTime
in class RelativeTime
dest
- Result is stored in dest and returned, when
null
, a new object is returned.public RationalTime set(long millis, int nanos)
set
in class HighResolutionTime<RelativeTime>
millis
- The new value for the millisecond field.nanos
- The new value for the nanosecond field.this
public void setFrequency(int frequency)
frequency
field.frequency
- The new value for the frequency
.java.lang.IllegalArgumentException
- when frequency
is
less than or equal to zero.public java.lang.String toString()
this
.
The string shall be a decimal representation of the frequency, milliseconds and nanosecond values; formatted as follows "(100, 2251 ms, 750000 ns)"
toString
in class RelativeTime
this
.