public class RemoteUptimeClock
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
calibrate(int sampleSize,
double samplingDelayMillis)
Good calibration settings will depend on the remote uptime provider.
|
static RemoteUptimeClock |
newDefault(TimeProvider timeProvider,
java.util.concurrent.Callable<java.lang.Double> callable,
double driftSensitivity,
double errorReductionCoefficientSensitivity,
int latencyOutlierFilterSampleSize,
double latencyOutlierFilterThreshold)
The provided
Callable should return the current
measuredRemoteUptime of the remote clock with minimal overhead since the
run time of this call will be used to further improve the estimation of
measuredRemoteUptime. |
double |
toLocalUptime(double remoteUptime)
Returns the estimated local uptime in seconds for the given remote uptime.
|
void |
update()
Update this
RemoteUptimeClock with the latest uptime from the
remote clock. |
public static RemoteUptimeClock newDefault(TimeProvider timeProvider, java.util.concurrent.Callable<java.lang.Double> callable, double driftSensitivity, double errorReductionCoefficientSensitivity, int latencyOutlierFilterSampleSize, double latencyOutlierFilterThreshold)
Callable
should return the current
measuredRemoteUptime of the remote clock with minimal overhead since the
run time of this call will be used to further improve the estimation of
measuredRemoteUptime.timeProvider
- the local time providercallable
- returns the current remote uptime in arbitrary unitsdriftSensitivity
- the sensitivity to drift adjustments, must be in the range [0, 1]errorReductionCoefficientSensitivity
- the sensitivity to error reduction coefficient adjustments, must
be in the range [0, 1]RemoteUptimeClock
public void calibrate(int sampleSize, double samplingDelayMillis)
sampleSize
- the number of samples to use for calibrationsamplingDelayMillis
- the delay in milliseconds between collecting each samplepublic void update()
RemoteUptimeClock
with the latest uptime from the
remote clock.
This will update internal estimates of drift and error. Ideally, it should be called periodically with a consistent time interval between updates (e.g. 10 seconds).
public double toLocalUptime(double remoteUptime)
remoteUptime
- the remote uptime to convert to local uptime