ServerClockOffset

constructor(localTimeMs: () -> Long = { System.currentTimeMillis() }, maxRttMs: Long = DEFAULT_MAX_RTT_MS, maxOffsetMs: Long = DEFAULT_MAX_OFFSET_MS)

Parameters

localTimeMs

Clock source for the local device time (injectable for tests).

maxRttMs

Upper bound on plausible RTT. Samples exceeding this are discarded as stale or mismatched. Defaults to the health check cycle interval (MONITOR_INTERVAL + HEALTH_CHECK_INTERVAL = 11 000 ms).

maxOffsetMs

Upper bound on the absolute value of the computed clock offset. If the derived offset exceeds this threshold the sample is considered unreliable (e.g. a stale / static server timestamp in a test environment) and the offset is reset to zero so that estimatedServerTime falls back to the raw local time. Defaults to 1 hour, which is already far beyond any real-world NTP drift.