Package org.apache.cassandra.utils
Class ApproximateTime
- java.lang.Object
-
- org.apache.cassandra.utils.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ApproximateTime.AlmostSameTime
static class
ApproximateTime.Measurement
-
Constructor Summary
Constructors Constructor Description ApproximateTime()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
currentTimeMillis()
no guarantees about relationship to nanoTime; non-monotonic (tracks currentTimeMillis as closely as possible)static long
nanoTime()
no guarantees about relationship to currentTimeMillis; monotonicstatic void
refresh(ApproximateTime.Measurement measurement)
Request an immediate refresh; this shouldn't generally be invoked, except perhaps by testsstatic void
start(ApproximateTime.Measurement measurement)
static void
stop(ApproximateTime.Measurement measurement)
-
-
-
Method Detail
-
stop
public static void stop(ApproximateTime.Measurement measurement)
-
start
public static void start(ApproximateTime.Measurement measurement)
-
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
-
-