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
Modifier and TypeFieldDescriptionstatic final long
These constants hold the number of nanoseconds of one second. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getZone()
int
hashCode()
instant()
long
millis()
long
nanos()
This returns the nanosecond-based instant, measured from 1970-01-01T00:00Z (UTC).static NanoClock
This clock is based on the nano system clock.static NanoClock
This clock is based on the nano system clock.static NanoClock
This 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:
withZone
in interfaceInstantSource
- Specified by:
withZone
in classClock
-
millis
- Specified by:
millis
in interfaceInstantSource
- Overrides:
millis
in 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:
instant
in interfaceInstantSource
- Specified by:
instant
in 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 givenzone
isnull
-
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 givenzone
isnull
-
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 givenzone
isnull
-