public class RouterClock extends Clock
| Modifier and Type | Class and Description |
|---|---|
static interface |
RouterClock.ClockShiftListener
Listener interface for receiving notifications when the router clock shifts.
|
Clock.ClockUpdateListener| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_STRATUM |
_alreadyChanged, _context, _isSystemClockBad, _offset, _startedOn, _statCreated, MAX_LIVE_OFFSET, MAX_OFFSET, MIN_OFFSET_CHANGE| Constructor and Description |
|---|
RouterClock(RouterContext context)
Does not start.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addShiftListener(RouterClock.ClockShiftListener lsnr)
Add a listener to be notified of massive system clock shifts.
|
long |
getDeltaOffset()
Deprecated.
|
Timestamper |
getTimestamper()
Get the timestamper used for time synchronization.
|
long |
now()
Retrieve the current time synchronized with whatever reference clock is in use.
|
void |
removeShiftListener(RouterClock.ClockShiftListener lsnr)
Remove a clock shift listener.
|
void |
setNow(long realTime,
int stratum)
Set the current time, used by the timestamper when synchronizing.
|
void |
setOffset(long offsetMs,
boolean force)
Specify how far away from the "correct" time the computer is - a positive
value means that the system time is slow, while a negative value means the system time is fast.
|
void |
start()
Start the router clock and its associated timestamper.
|
addUpdateListener, fireOffsetChanged, getInstance, getLog, getOffset, getUpdatedSuccessfully, removeUpdateListener, setNow, setOffsetpublic static final int DEFAULT_STRATUM
public RouterClock(RouterContext context)
public void addShiftListener(RouterClock.ClockShiftListener lsnr)
lsnr - the listener to add@Deprecated public long getDeltaOffset()
public Timestamper getTimestamper()
getTimestamper in class Clockpublic long now()
public void removeShiftListener(RouterClock.ClockShiftListener lsnr)
lsnr - the listener to removepublic void setNow(long realTime,
int stratum)
setNow in interface Timestamper.UpdateListenersetNow in class ClockrealTime - the current time from the time sourcestratum - the stratum level of the time source (lower is better)public void setOffset(long offsetMs,
boolean force)
public void start()