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
ConstructorDescriptionDeltaClock
(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 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 DeltaClock
Constructs 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:Clock
Milliseconds since the epoch, 1970-01-01T00:00:00Z.The resolution is dependent on the JVM and underlying implementation.
- Specified by:
currentTimeMillis
in interfaceClock
- Returns:
- epoch millis
-
currentTimeMicros
public long currentTimeMicros()Description copied from interface:Clock
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
Clock.currentTimeMillis()
.- Specified by:
currentTimeMicros
in interfaceClock
- Returns:
- epoch microseconds
-
currentTimeNanos
public long currentTimeNanos()Description copied from interface:Clock
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
Clock.currentTimeMicros()
andClock.currentTimeMillis()
.- Specified by:
currentTimeNanos
in interfaceClock
- Returns:
- epoch nanoseconds
-
instantNanos
Description copied from interface:Clock
The instant.Has resolution equal to
Clock.currentTimeNanos()
.If you don't need the resolution provided by
Clock.currentTimeNanos()
, preferClock.instantMillis()
.- Specified by:
instantNanos
in interfaceClock
- Returns:
- the instant
-
instantMillis
Description copied from interface:Clock
The instant.Has resolution greater than or equal to
Clock.currentTimeMillis()
.- Specified by:
instantMillis
in interfaceClock
- Returns:
- the instant.
-