public final class NtpTimeSample extends Object
TimeSample produced by an NTP/SNTP query, enriched with the packet metadata that lets the aggregator weight it well.An NTP reading carries more than just "what time is it": the server reports its distance from a reference clock (stratum()), how much error has accumulated (rootDispersionSeconds()), and the query's measured round-trip delay (roundTripDelaySeconds()). Together with the computed clock offset these let a consumer judge how good the reading is. The base sample() already carries a derived accuracyPercent (see the SNTP client), but the raw fields are kept here so the aggregator can re-weight with its own policy if it wishes.
This type is a plain, immutable value object and contains no licensing logic. It wraps a TimeSample (composition) rather than extending it, so the base sample stays inert and the NTP-specific data is clearly separated.
(C) Copyright 2026 Mindus SARL. All rights reserved.
| Constructor and Description |
|---|
NtpTimeSample(TimeSample sample, int stratum, double rootDispersionSeconds, double roundTripDelaySeconds, double clockOffsetSeconds, int serverPrecisionExponent)Creates an NTP time sample. |
| Modifier and Type | Method and Description |
|---|---|
double | clockOffsetSeconds()The computed clock offset (server minus local), in seconds. |
double | rootDispersionSeconds()The server's root dispersion, in seconds. |
double | roundTripDelaySeconds()The measured round-trip delay of the query, in seconds. |
TimeSample | sample()The base time reading. |
int | serverPrecisionExponent()The server's reported precision as a signed power-of-two exponent of seconds. |
int | stratum()The NTP stratum of the queried server. |
String | toString()Returns a trace-friendly description. |
public NtpTimeSample(TimeSample sample, int stratum, double rootDispersionSeconds, double roundTripDelaySeconds, double clockOffsetSeconds, int serverPrecisionExponent)
sample - The base reading (must not be null).stratum - The server stratum.rootDispersionSeconds - Root dispersion in seconds.roundTripDelaySeconds - Measured round-trip delay in seconds.clockOffsetSeconds - Computed clock offset (server minus local) in seconds.serverPrecisionExponent - The server's precision as a power-of-two exponent of seconds.public TimeSample sample()
TimeSample (never null).public int stratum()
public double rootDispersionSeconds()
public double roundTripDelaySeconds()
public double clockOffsetSeconds()
public int serverPrecisionExponent()
For example -20 means roughly 2^-20 seconds (about one microsecond). This is the raw NTP precision field.
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.