< prev index next >

src/java.base/share/classes/java/time/Clock.java

Print this page

        

*** 477,486 **** --- 477,487 ---- /** * Implementation of a clock that always returns the latest time from * {@link System#currentTimeMillis()}. */ static final class SystemClock extends Clock implements Serializable { + @java.io.Serial private static final long serialVersionUID = 6740630888130243051L; private static final long OFFSET_SEED = System.currentTimeMillis()/1000 - 1024; // initial offest static final SystemClock UTC = new SystemClock(ZoneOffset.UTC);
*** 570,579 **** --- 571,581 ---- } @Override public String toString() { return "SystemClock[" + zone + "]"; } + @java.io.Serial private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { // ensure that offset is initialized is.defaultReadObject(); offset = OFFSET_SEED;
*** 584,593 **** --- 586,596 ---- /** * Implementation of a clock that always returns the same instant. * This is typically used for testing. */ static final class FixedClock extends Clock implements Serializable { + @java.io.Serial private static final long serialVersionUID = 7430389292664866958L; private final Instant instant; private final ZoneId zone; FixedClock(Instant fixedInstant, ZoneId zone) {
*** 634,643 **** --- 637,647 ---- //----------------------------------------------------------------------- /** * Implementation of a clock that adds an offset to an underlying clock. */ static final class OffsetClock extends Clock implements Serializable { + @java.io.Serial private static final long serialVersionUID = 2007484719125426256L; private final Clock baseClock; private final Duration offset; OffsetClock(Clock baseClock, Duration offset) {
*** 684,693 **** --- 688,698 ---- //----------------------------------------------------------------------- /** * Implementation of a clock that adds an offset to an underlying clock. */ static final class TickClock extends Clock implements Serializable { + @java.io.Serial private static final long serialVersionUID = 6504659149906368850L; private final Clock baseClock; private final long tickNanos; TickClock(Clock baseClock, long tickNanos) {
< prev index next >