Package io.opencensus.common
Class Clock
- java.lang.Object
-
- io.opencensus.common.Clock
-
- Direct Known Subclasses:
MillisClock
,TestClock
,ZeroTimeClock
public abstract class Clock extends java.lang.Object
Interface for getting the current time.- Since:
- 0.5
-
-
Constructor Summary
Constructors Constructor Description Clock()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract Timestamp
now()
Obtains the current instant from this clock.abstract long
nowNanos()
Returns a time measurement with nanosecond precision that can only be used to calculate elapsed time.
-
-
-
Method Detail
-
now
public abstract Timestamp now()
Obtains the current instant from this clock.- Returns:
- the current instant.
- Since:
- 0.5
-
nowNanos
public abstract long nowNanos()
Returns a time measurement with nanosecond precision that can only be used to calculate elapsed time.- Returns:
- a time measurement with nanosecond precision that can only be used to calculate elapsed time.
- Since:
- 0.5
-
-