public class StandardTimepoint extends Object implements Timepoint
| Constructor and Description |
|---|
StandardTimepoint(long sinceEpoch,
TimestampProvider provider)
Number of time units elapsed between the UNIX Epoch and this instant.
|
| Modifier and Type | Method and Description |
|---|---|
StandardTimepoint |
add(Duration addend)
Returns a new Timepoint which is the given duration later in time.
|
int |
compareTo(Timepoint other) |
boolean |
equals(Object obj) |
long |
getNativeTimestamp()
Returns the elapsed time since UNIX epoch of this time point in the native unit.
|
TimeUnit |
getNativeUnit()
Returns the native time unit of this time point as given by the backing
TimestampProvider. |
TimestampProvider |
getProvider()
Returns the backing
TimestampProvider. |
long |
getTimestamp(TimeUnit returnUnit)
Returns this timepoint as the elapsed time since UNIX epoch in the given time unit.
|
int |
hashCode() |
Timepoint |
sleepPast()
Causes this thread to sleep past this time point.
|
StandardTimepoint |
sub(Duration subtrahend)
Returns a new Timepoint that is the given duration earlier in time.
|
String |
toString() |
public StandardTimepoint(long sinceEpoch,
TimestampProvider provider)
sinceEpoch may by any value in the representable range of long.sinceEpoch - time units since UNIX Epochprovider - the underlying TimestampProvider that the timestamp is based off ofpublic long getTimestamp(TimeUnit returnUnit)
TimepointgetTimestamp in interface Timepointpublic StandardTimepoint add(Duration addend)
Timepointpublic StandardTimepoint sub(Duration subtrahend)
Timepointpublic TimeUnit getNativeUnit()
TimepointTimestampProvider.
Equivalent to getProvider().getUnit().getNativeUnit in interface Timepointpublic long getNativeTimestamp()
TimepointgetTimestamp(getNativeUnit())getNativeTimestamp in interface Timepointpublic TimestampProvider getProvider()
TimepointTimestampProvider.getProvider in interface Timepointpublic Timepoint sleepPast() throws InterruptedException
TimepointsleepPast in interface TimepointInterruptedExceptionpublic int compareTo(Timepoint other)
compareTo in interface Comparable<Timepoint>Copyright © 2012–2014. All rights reserved.