@MinDoc(copyright="Copyright 2016 A. Weinert", author="Albrecht Weinert", version="V.33", lastModified="27.03.2021", usage="make read update read ....", purpose="a versatile Clock for real time applications") public final class FixClock extends Clock implements Serializable, AClock
AClock
with fixed
time and zone. It may be used to hold time stamps.SynClock
,
Serialized FormModifier and Type | Field and Description |
---|---|
Instant |
actTime
The fixed time.
|
long |
actTimeMS
The fixed time.
|
ZonedDateTime |
actTimeZd
The fixed time and zone.
|
ZoneId |
zone
This Clock's / FixClocks's time-zone.
|
Modifier | Constructor and Description |
---|---|
protected |
FixClock(Instant actTime,
ZonedDateTime actTimeZd)
Internal constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compare with other Objects's state.
|
FixClock |
fix()
Provide a FixClock with a fixed time according to current state.
|
ZonedDateTime |
getActTime()
The zone related time of this FixClock.
|
ZonedDateTime |
getActTime(ZoneId zone)
The current zone related time of this FixClock.
|
ZoneId |
getZone()
The clock's time-zone.
|
int |
hashCode() |
Instant |
instant()
The current instant of this FixClock.
|
long |
millis()
The time of this FixClock.
|
static FixClock |
of(ZonedDateTime actTimeZd)
Make or get a FixClock.
|
static FixClock |
ofInstant(Instant actTime,
ZoneId zone)
Make or get a FixClock.
|
ZonedDateTime |
setActTime()
Update and get current zone related time of this FixClock.
|
long |
setActTimeMs()
Update this FixClock.
|
Instant |
setInstant()
The instant of this FixClock.
|
String |
toString()
The state as String.
|
boolean |
update()
Update this FixClock (no action).
|
FixClock |
withZone(ZoneId zone)
Provide another FixClock with a different time-zone.
|
fixed, offset, system, systemDefaultZone, systemUTC, tick, tickMinutes, tickSeconds
public final ZoneId zone
public Instant actTime
public final long actTimeMS
public final ZonedDateTime actTimeZd
protected FixClock(Instant actTime, ZonedDateTime actTimeZd)
actTime
- the instant; must be either consistent to actTimeZd
or nullactTimeZd
- the time and the zone; must not be nullpublic static FixClock of(ZonedDateTime actTimeZd)
actTimeZd
- the time and the zone; must not be nullpublic static FixClock ofInstant(Instant actTime, ZoneId zone)
actTime
- the time; must not be nullzone
- the zone; must not be nullpublic final ZoneId getZone()
public final Instant instant()
public final Instant setInstant()
setInstant
in interface AClock
public final long millis()
public final ZonedDateTime getActTime()
getActTime
in interface AClock
time
related
to this FixClock's zone
public final ZonedDateTime setActTime()
setActTime
in interface AClock
time
related to
this SynClock's zone
public final ZonedDateTime getActTime(ZoneId zone)
getActTime
in interface AClock
zone
- the zone to relate to;
null will be this SynClock's zone
public boolean update()
public final long setActTimeMs()
setActTimeMs
in interface AClock
public String toString()
public boolean equals(Object obj)
FixClock
.hashCode()
. Objects of FixClock
are
suitable as hash keys, those of other AClock
descendants mostly
aren't.