This is an automated email from the ASF dual-hosted git repository.

pnowojski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 8ad03460f04cc0a6f1be9ef508a1bede928dcd0a
Author: Piotr Nowojski <piotr.nowoj...@gmail.com>
AuthorDate: Mon Aug 5 16:41:19 2024 +0200

    [FLINK-35886][task] Define RelativeClock interface
---
 .../java/org/apache/flink/util/clock/Clock.java    |  2 +-
 .../util/clock/{Clock.java => RelativeClock.java}  | 27 +++++-----------------
 2 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/flink-core/src/main/java/org/apache/flink/util/clock/Clock.java 
b/flink-core/src/main/java/org/apache/flink/util/clock/Clock.java
index 29a05aacf28..879cbfca9c6 100644
--- a/flink-core/src/main/java/org/apache/flink/util/clock/Clock.java
+++ b/flink-core/src/main/java/org/apache/flink/util/clock/Clock.java
@@ -37,7 +37,7 @@ import org.apache.flink.annotation.PublicEvolving;
  * the system clock, so it never jumps. Relative time behaves similar to 
{@link System#nanoTime()}.
  */
 @PublicEvolving
-public abstract class Clock {
+public abstract class Clock implements RelativeClock {
 
     /** Gets the current absolute time, in milliseconds. */
     public abstract long absoluteTimeMillis();
diff --git a/flink-core/src/main/java/org/apache/flink/util/clock/Clock.java 
b/flink-core/src/main/java/org/apache/flink/util/clock/RelativeClock.java
similarity index 50%
copy from flink-core/src/main/java/org/apache/flink/util/clock/Clock.java
copy to flink-core/src/main/java/org/apache/flink/util/clock/RelativeClock.java
index 29a05aacf28..990de585c7a 100644
--- a/flink-core/src/main/java/org/apache/flink/util/clock/Clock.java
+++ b/flink-core/src/main/java/org/apache/flink/util/clock/RelativeClock.java
@@ -21,30 +21,15 @@ package org.apache.flink.util.clock;
 import org.apache.flink.annotation.PublicEvolving;
 
 /**
- * A clock that gives access to time. This clock returns two flavors of time:
- *
- * <h3>Absolute Time</h3>
- *
- * <p>This refers to real world wall clock time, and it is typically derived 
from a system clock. It
- * is subject to clock drift and inaccuracy, and can jump if the system clock 
is adjusted. Absolute
- * time behaves similar to {@link System#currentTimeMillis()}.
- *
- * <h3>Relative Time</h3>
- *
- * <p>This time advances at the same speed as the <i>absolute time</i>, but 
the timestamps can only
- * be referred to relative to each other. The timestamps have no absolute 
meaning and cannot be
- * compared across JVM processes. The source for the timestamps is not 
affected by adjustments to
- * the system clock, so it never jumps. Relative time behaves similar to 
{@link System#nanoTime()}.
+ * A clock that gives access to relative time, similar to System#nanoTime(), 
however the progress of
+ * the relative time doesn't have to reflect the progress of a wall clock. 
Concrete classes can
+ * specify a different contract in that regard. Returned time must be 
monotonically increasing.
  */
 @PublicEvolving
-public abstract class Clock {
-
-    /** Gets the current absolute time, in milliseconds. */
-    public abstract long absoluteTimeMillis();
-
+public interface RelativeClock {
     /** Gets the current relative time, in milliseconds. */
-    public abstract long relativeTimeMillis();
+    long relativeTimeMillis();
 
     /** Gets the current relative time, in nanoseconds. */
-    public abstract long relativeTimeNanos();
+    long relativeTimeNanos();
 }

Reply via email to