Class MonotonicClock

java.lang.Object
org.apache.hadoop.yarn.util.MonotonicClock
All Implemented Interfaces:
Clock

@Public @Evolving public class MonotonicClock extends Object implements Clock
A monotonic clock from some arbitrary time base in the past, counting in milliseconds, and not affected by settimeofday or similar system clock changes. This is appropriate to use when computing how much longer to wait for an interval to expire. This function can return a negative value and it must be handled correctly by callers. See the documentation of System#nanoTime for caveats.
  • Constructor Details

    • MonotonicClock

      public MonotonicClock()
  • Method Details

    • getTime

      public long getTime()
      Get current time from some arbitrary time base in the past, counting in milliseconds, and not affected by settimeofday or similar system clock changes.
      Specified by:
      getTime in interface Clock
      Returns:
      a monotonic clock that counts in milliseconds.