Package io.deephaven.base.clock
Class DeltaClock
java.lang.Object
io.deephaven.base.clock.DeltaClock
- All Implemented Interfaces:
Clock
A clock impl with a delta adjustment.
-
Constructor Summary
ConstructorsConstructorDescriptionDeltaClock(long deltaNanos) Constructs a delta clock with aClock.system()clock.DeltaClock(Clock delegate, long deltaNanos) Constructs a delta clock with the provided clock and delta. -
Method Summary
Modifier and TypeMethodDescriptionlongMicroseconds since the epoch, 1970-01-01T00:00:00Z.longMilliseconds since the epoch, 1970-01-01T00:00:00Z.longNanoseconds since the epoch, 1970-01-01T00:00:00Z.The instant.The instant.static DeltaClockConstructs a delta clock with aClock.system()clock.
-
Constructor Details
-
DeltaClock
public DeltaClock(long deltaNanos) Constructs a delta clock with aClock.system()clock.- Parameters:
deltaNanos- the delta nanos
-
DeltaClock
Constructs a delta clock with the provided clock and delta.- Parameters:
delegate- the base clockdeltaNanos- the delta nanos
-
-
Method Details
-
of
Constructs a delta clock with aClock.system()clock.- Parameters:
duration- the duration- Returns:
- the clock
-
currentTimeMillis
public long currentTimeMillis()Description copied from interface:ClockMilliseconds since the epoch, 1970-01-01T00:00:00Z.The resolution is dependent on the JVM and underlying implementation.
- Specified by:
currentTimeMillisin interfaceClock- Returns:
- epoch millis
-
currentTimeMicros
public long currentTimeMicros()Description copied from interface:ClockMicroseconds 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
Clock.currentTimeMillis().- Specified by:
currentTimeMicrosin interfaceClock- Returns:
- epoch microseconds
-
currentTimeNanos
public long currentTimeNanos()Description copied from interface:ClockNanoseconds 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
Clock.currentTimeMicros()andClock.currentTimeMillis().- Specified by:
currentTimeNanosin interfaceClock- Returns:
- epoch nanoseconds
-
instantNanos
Description copied from interface:ClockThe instant.Has resolution equal to
Clock.currentTimeNanos().If you don't need the resolution provided by
Clock.currentTimeNanos(), preferClock.instantMillis().- Specified by:
instantNanosin interfaceClock- Returns:
- the instant
-
instantMillis
Description copied from interface:ClockThe instant.Has resolution greater than or equal to
Clock.currentTimeMillis().- Specified by:
instantMillisin interfaceClock- Returns:
- the instant.
-