public final class SntpMessage extends Object
Message for the SNTP-protocol (RFC 4330).
NTP-timestamps will be calculated at best in microsecond precision.
| Modifier and Type | Method and Description |
|---|---|
static long |
convert(double ntpTimestamp)
Converts given NTP-timestamp to a microsecond value relative to
the UNIX- epoch.
|
byte |
getLeapIndicator()
Yields the LI-bits as appointment of a coming leap second.
|
byte |
getMode()
Displays the mode.
|
double |
getOriginateTimestamp()
NTP-timestamp when the client request was sent.
|
int |
getPollInterval()
Yields the maximum interval between two successful server messages
in seconds as exponent for base 2.
|
int |
getPrecision()
Yields the precision of the server clock in seconds as exponent
for the base 2.
|
double |
getReceiveTimestamp()
NTP-timestamp when the server received the client request.
|
String |
getReferenceIdentifier()
Identifies a reference source.
|
double |
getReferenceTimestamp()
NTP-timestamp when the time of the server was set or corrected
last time.
|
double |
getRootDelay()
Yields the total delay in seconds relative to the primary source.
|
double |
getRootDispersion()
Yields the maximum error in seconds relative to the primary
source.
|
short |
getStratum()
Displays the stratum-value indicating the distance of
the original time source.
|
double |
getTransmitTimestamp()
NTP-timestamp when the client or server request was sent.
|
byte |
getVersion()
Displays the NTP-version.
|
String |
toString()
Returns a human-readable form of the internal state.
|
public byte getLeapIndicator()
Yields the LI-bits as appointment of a coming leap second.
public byte getVersion()
Displays the NTP-version.
public byte getMode()
Displays the mode.
public short getStratum()
Displays the stratum-value indicating the distance of the original time source.
Usually it is the count of involved clock servers respective
layers. The value 0 indicates a kiss-o'-death-message
by which the server signals to the client that repeated requests should
be immediately stopped.
public int getPollInterval()
Yields the maximum interval between two successful server messages in seconds as exponent for base 2.
This property is only relevant if the server is sending messages
in the broadcast-mode. In all other cases the server should
send the value0.
4 <= pollInterval <= 17public int getPrecision()
Yields the precision of the server clock in seconds as exponent for the base 2.
-6 <= precision <= -23public double getRootDelay()
Yields the total delay in seconds relative to the primary source.
This information only concerns the NTP-server, not the actual network traffic with the client.
public double getRootDispersion()
Yields the maximum error in seconds relative to the primary source.
This information only concerns the NTP-server, not the actual network traffic with the client.
public String getReferenceIdentifier()
Identifies a reference source.
If the connected server is a primary NTP-server (stratum = 1) then the return value will usually be a string from following list:
A secondary IPv4-server will return a 32-bit-IP-address else the return value represents the first 32 bits of a MD5-hash value of a IPv6- or NSAP-address of the synchronization source.
In case of a (stratum == 0) - reply of the server the
return value describes a kiss-or-death-message. The client should
then not repeat the request (or at least not within the next minute).
A non-exhausting selection:
public double getReferenceTimestamp()
NTP-timestamp when the time of the server was set or corrected last time.
The method yields 0 if no request has been sent yet.
public double getOriginateTimestamp()
NTP-timestamp when the client request was sent.
The method yields 0 if no request has been sent yet.
public double getReceiveTimestamp()
NTP-timestamp when the server received the client request.
The method yields 0 if no request has been sent yet.
public double getTransmitTimestamp()
NTP-timestamp when the client or server request was sent.
public String toString()
Returns a human-readable form of the internal state.
public static long convert(double ntpTimestamp)
Converts given NTP-timestamp to a microsecond value relative to the UNIX- epoch.
ntpTimestamp - NTP-timestamp (seconds since 1900-01-01)Copyright © 2014–2016. All rights reserved.