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