public interface TimestampProvider
| Modifier and Type | Method and Description |
|---|---|
Timepoint |
getTime()
Returns the current time based on this timestamp provider
as a
Timepoint. |
Timepoint |
getTime(long sinceEpoch,
TimeUnit unit)
Returns the given time as a
Timepoint based off of this timestamp provider |
Timer |
getTimer()
Returns a
Timer based on this timestamp provider |
TimeUnit |
getUnit()
Return the units of
getTime(). |
void |
sleepFor(Duration duration)
Sleep for the given duration of time.
|
Timepoint |
sleepPast(Timepoint futureTime)
Block until the current time as returned by
getTime() is greater
than the given timepoint. |
Timepoint getTime()
Timepoint.Timepoint getTime(long sinceEpoch, TimeUnit unit)
Timepoint based off of this timestamp providersinceEpoch - unit - TimeUnit getUnit()
getTime(). This method's return value must
be constant over at least the life of the object implementing this
interface.Timepoint sleepPast(Timepoint futureTime) throws InterruptedException
getTime() is greater
than the given timepoint.futureTime - The time to sleep pastunit argumentInterruptedException - if externally interruptedvoid sleepFor(Duration duration) throws InterruptedException
duration - InterruptedExceptionCopyright © 2012–2014. All rights reserved.