Enum Class SystemClockUtc
- All Implemented Interfaces:
Clock
,SystemClock
,Serializable
,Comparable<SystemClockUtc>
,java.lang.constant.Constable
- See Also:
-
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
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 SystemClockUtc
Returns the enum constant of this class with the specified name.static SystemClockUtc[]
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()Milliseconds since the epoch, 1970-01-01T00:00:00Z.The resolution is dependent on the JVM and underlying implementation.
Equivalent to
System.currentTimeMillis()
. This is the same source asClock.systemUTC()
.- Specified by:
currentTimeMillis
in interfaceClock
- Returns:
- the current system time in epoch millis
-
currentTimeMicros
public 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
Clock.currentTimeMillis()
.Calculates the time from
Clock.systemUTC()
. If you don't need need microsecond resolution, prefercurrentTimeMillis()
.Note: this method may allocate.
- 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
java.time.Clock.systemUTC().instant()
.- 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.
-