public interface TimeMeter
An abstraction over time measurement.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TimeMeterThe implementation ofTimeMeterwhich works aroundSystem.currentTimeMillis()static final TimeMeterThe implementation ofTimeMeterwhich works aroundSystem.nanoTime() -
Method Summary
Modifier and TypeMethodDescriptionlongReturns current time in nanosecond precision, but not necessarily nanosecond resolution.booleanReturnstrueif implementation of clock behaves the similar way asSystem.currentTimeMillis(), in other words if implementation can be used in distributed scenarios and returns approximately the same time in all machines in cluster
-
Field Details
-
SYSTEM_NANOTIME
The implementation ofTimeMeterwhich works aroundSystem.nanoTime() -
SYSTEM_MILLISECONDS
The implementation ofTimeMeterwhich works aroundSystem.currentTimeMillis()
-
-
Method Details
-
currentTimeNanos
long currentTimeNanos()Returns current time in nanosecond precision, but not necessarily nanosecond resolution.- Returns:
- current time in nanoseconds
-
isWallClockBased
boolean isWallClockBased()Returnstrueif implementation of clock behaves the similar way asSystem.currentTimeMillis(), in other words if implementation can be used in distributed scenarios and returns approximately the same time in all machines in cluster- Returns:
trueif implementation can be used as wall clock
-