public interface TimestampProvider
Modifier and Type | Method and Description |
---|---|
Instant |
getTime()
Returns the current time based on this timestamp provider
as a
Instant . |
long |
getTime(Instant timestamp)
Returns the scalar value for this instant given the configured time unit
|
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 |
ChronoUnit |
getUnit()
Return the units of
getTime() . |
void |
sleepFor(Duration duration)
Sleep for the given duration of time.
|
Instant |
sleepPast(Instant futureTime)
Block until the current time as returned by
getTime() is greater
than the given timepoint. |
Instant getTime()
Instant
.Instant getTime(long sinceEpoch)
Instant
based off of this timestamp providers unitssinceEpoch
- ChronoUnit getUnit()
getTime()
. This method's return value must
be constant over at least the life of the object implementing this
interface.Instant sleepPast(Instant 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
- InterruptedException
long getTime(Instant timestamp)
timestamp
- Copyright © 2012–2024. All rights reserved.