Enum Class SystemClockMillis
- All Implemented Interfaces:
Clock
,SystemClock
,Serializable
,Comparable<SystemClockMillis>
,java.lang.constant.Constable
System.currentTimeMillis()
.
This clock differs from SystemClockUtc
in that all timestamp methods have millisecond-level resolution.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
Fields inherited from interface io.deephaven.base.clock.SystemClock
DEFAULT, KEY, SERVICE_LOADER, SYSTEM_MILLIS, SYSTEM_UTC
-
Method Summary
Modifier and TypeMethodDescriptionlong
Equivalent toSystem.currentTimeMillis() * 1_000
.long
Equivalent toSystem.currentTimeMillis()
.long
Nanoseconds since the epoch, 1970-01-01T00:00:00Z.The instant.The instant.static SystemClockMillis
Returns the enum constant of this class with the specified name.static SystemClockMillis[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
currentTimeMillis
public long currentTimeMillis()Equivalent toSystem.currentTimeMillis()
.- Specified by:
currentTimeMillis
in interfaceClock
- Returns:
- epoch millis
-
currentTimeMicros
public long currentTimeMicros()Equivalent toSystem.currentTimeMillis() * 1_000
.- Specified by:
currentTimeMicros
in interfaceClock
- Returns:
- epoch microseconds
-
currentTimeNanos
public 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
Clock.currentTimeMicros()
andClock.currentTimeMillis()
.Calculates the time from
Clock.systemUTC()
. If you don't need nanosecond resolution, prefercurrentTimeMillis()
.Note: this method may allocate.
- Specified by:
currentTimeNanos
in interfaceClock
- Returns:
- epoch nanoseconds
-
instantNanos
The instant.Has resolution equal to
Clock.currentTimeNanos()
.If you don't need the resolution provided by
Clock.currentTimeNanos()
, preferClock.instantMillis()
.Equivalent to
Instant.ofEpochMilli(System.currentTimeMillis())
.- Specified by:
instantNanos
in interfaceClock
- Returns:
- the instant
-
instantMillis
The instant.Has resolution greater than or equal to
Clock.currentTimeMillis()
.Equivalent to
Instant.ofEpochMilli(System.currentTimeMillis())
.- Specified by:
instantMillis
in interfaceClock
- Returns:
- the instant.
-