java.lang.Object
java.time.Clock
io.jenetics.util.NanoClock
- All Implemented Interfaces:
Serializable,InstantSource
Clock implementation with nano second precision.
- Since:
- 3.1
- Version:
- 3.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThese constants hold the number of nanoseconds of one second. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetZone()inthashCode()instant()longmillis()longnanos()This returns the nanosecond-based instant, measured from 1970-01-01T00:00Z (UTC).static NanoClockThis clock is based on the nano system clock.static NanoClockThis clock is based on the nano system clock.static NanoClockThis clock is based on the nano system clock.toString()Methods inherited from class java.time.Clock
fixed, offset, tick, tickMillis, tickMinutes, tickSeconds
-
Field Details
-
NANOS_PER_SECOND
These constants hold the number of nanoseconds of one second.- See Also:
-
-
Method Details
-
getZone
-
withZone
- Specified by:
withZonein interfaceInstantSource- Specified by:
withZonein classClock
-
millis
- Specified by:
millisin interfaceInstantSource- Overrides:
millisin classClock
-
nanos
This returns the nanosecond-based instant, measured from 1970-01-01T00:00Z (UTC). This method will return valid values till the year 2262.- Returns:
- the nanosecond-based instant, measured from 1970-01-01T00:00Z (UTC)
-
instant
- Specified by:
instantin interfaceInstantSource- Specified by:
instantin classClock
-
hashCode
-
equals
-
toString
-
system
This clock is based on the nano system clock. It usesSystem.nanoTime()resolutionConversion from instant to date or time uses the specified time-zone.
The returned implementation is immutable, thread-safe and
Serializable.- Parameters:
zone- the time-zone to use to convert the instant to date-time- Returns:
- a clock that uses the best available system clock in the specified zone
- Throws:
NullPointerException- if the givenzoneisnull
-
systemUTC
This clock is based on the nano system clock. It usesSystem.nanoTime()resolutionConversion from instant to date or time uses the specified time-zone.
The returned implementation is immutable, thread-safe and
Serializable.- Returns:
- a clock that uses the best available system clock in the UTC zone
- Throws:
NullPointerException- if the givenzoneisnull
-
systemDefaultZone
This clock is based on the nano system clock. It usesSystem.nanoTime()resolutionConversion from instant to date or time uses the specified time-zone.
The returned implementation is immutable, thread-safe and
Serializable.- Returns:
- a clock that uses the best available system clock in the default zone
- Throws:
NullPointerException- if the givenzoneisnull
-