public abstract class TimeSource
extends java.lang.Object
Note: this interface can be used to measure both wall time or elapsed time.
Modifier | Constructor and Description |
---|---|
protected |
TimeSource()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
static TimeSource |
fromTicker(com.google.common.base.Ticker ticker) |
abstract long |
read()
Returns the number of milliseconds elapsed since this ticker's fixed point of reference.
|
static TimeSource |
systemTimeSource()
A ticker that reads the current time using
System.currentTimeMillis() . |
static com.google.common.base.Ticker |
toTicker(TimeSource source) |
public static final TimeSource fromTicker(com.google.common.base.Ticker ticker)
public static final com.google.common.base.Ticker toTicker(TimeSource source)
public static final TimeSource systemTimeSource()
System.currentTimeMillis()
.public abstract long read()