Class ApproximateTime


  • public class ApproximateTime
    extends java.lang.Object
    This class provides approximate time utilities: - An imprecise nanoTime (monotonic) and currentTimeMillis (non-monotonic), that are faster than their regular counterparts They have a configured approximate precision (default of 10ms), which is the cadence they will be updated if the system is healthy - A mechanism for converting between nanoTime and currentTimeMillis measurements. These conversions may have drifted, and they offer no absolute guarantees on precision
    • Constructor Detail

      • ApproximateTime

        public ApproximateTime()
    • Method Detail

      • refresh

        public static void refresh​(ApproximateTime.Measurement measurement)
        Request an immediate refresh; this shouldn't generally be invoked, except perhaps by tests
      • currentTimeMillis

        public static long currentTimeMillis()
        no guarantees about relationship to nanoTime; non-monotonic (tracks currentTimeMillis as closely as possible)
      • nanoTime

        public static long nanoTime()
        no guarantees about relationship to currentTimeMillis; monotonic