Package io.deephaven.base.clock
Interface Clock
- All Known Subinterfaces:
Scheduler
,SystemClock
- All Known Implementing Classes:
ClockNanoBase
,DeltaClock
,Scheduler.DelegatingImpl
,SimulationClock
,SystemClockMillis
,SystemClockUtc
public interface Clock
Provides time-based methods. Callers should prefer the methods most appropriate for their use-case and desired
resolution. The performance of the methods may differ depending on the resolution they provide.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlong
Microseconds since the epoch, 1970-01-01T00:00:00Z.long
Milliseconds since the epoch, 1970-01-01T00:00:00Z.long
Nanoseconds since the epoch, 1970-01-01T00:00:00Z.The instant.The instant.static SystemClock
system()
TheSystemClock
.
-
Method Details
-
system
TheSystemClock
. Provides singleton semantics aroundSystemClock.of()
.- Returns:
- the system clock
-
currentTimeMillis
long currentTimeMillis()Milliseconds since the epoch, 1970-01-01T00:00:00Z.The resolution is dependent on the JVM and underlying implementation.
- Returns:
- epoch millis
-
currentTimeMicros
long currentTimeMicros()Microseconds since the epoch, 1970-01-01T00:00:00Z.The resolution is dependent on the JVM and underlying implementation. The resolution is greater than or equal to
currentTimeMillis()
.- Returns:
- epoch microseconds
-
currentTimeNanos
long currentTimeNanos()Nanoseconds since the epoch, 1970-01-01T00:00:00Z.The resolution is dependent on the JVM and underlying implementation. The resolution is greater than or equal to
currentTimeMicros()
andcurrentTimeMillis()
.- Returns:
- epoch nanoseconds
-
instantNanos
Instant instantNanos()The instant.Has resolution equal to
currentTimeNanos()
.If you don't need the resolution provided by
currentTimeNanos()
, preferinstantMillis()
.- Returns:
- the instant
-
instantMillis
Instant instantMillis()The instant.Has resolution greater than or equal to
currentTimeMillis()
.- Returns:
- the instant.
-