/*** * Returns the reference id string. String cannot be null but * value is dependent on the version of the NTP spec supported * and stratum level. Value can be an empty string, clock type string, * IP address, or a hex string. * * @return the reference id string. */ @Override public String getReferenceIdString() { int version = getVersion(); int stratum = getStratum(); if (version == VERSION_3 || version == VERSION_4) { if (stratum == 0 || stratum == 1) { return idAsString(); // 4-character ASCII string (e.g. GPS, USNO) } // in NTPv4 servers this is latest transmit timestamp of ref source if (version == VERSION_4) { return idAsHex(); } } // Stratum 2 and higher this is a four-octet IPv4 address // of the primary reference host. if (stratum >= 2) { return idAsIPAddress(); } return idAsHex(); }
/*** * Returns details of NTP packet as a string. * * @return details of NTP packet as a string. */ @Override public String toString() { return "[" + "version:" + getVersion() + ", mode:" + getMode() + ", poll:" + getPoll() + ", precision:" + getPrecision() + ", delay:" + getRootDelay() + ", dispersion(ms):" + getRootDispersionInMillisDouble() + ", id:" + getReferenceIdString() + ", xmitTime:" + getTransmitTimeStamp().toDateString() + " ]"; }
/*** * Returns the reference id string. String cannot be null but * value is dependent on the version of the NTP spec supported * and stratum level. Value can be an empty string, clock type string, * IP address, or a hex string. * * @return the reference id string. */ public String getReferenceIdString() { int version = getVersion(); int stratum = getStratum(); if (version == VERSION_3 || version == VERSION_4) { if (stratum == 0 || stratum == 1) { return idAsString(); // 4-character ASCII string (e.g. GPS, USNO) } // in NTPv4 servers this is latest transmit timestamp of ref source if (version == VERSION_4) return idAsHex(); } // Stratum 2 and higher this is a four-octet IPv4 address // of the primary reference host. if (stratum >= 2) { return idAsIPAddress(); } return idAsHex(); }
/*** * Returns the reference id string. String cannot be null but * value is dependent on the version of the NTP spec supported * and stratum level. Value can be an empty string, clock type string, * IP address, or a hex string. * * @return the reference id string. */ public String getReferenceIdString() { int version = getVersion(); int stratum = getStratum(); if (version == VERSION_3 || version == VERSION_4) { if (stratum == 0 || stratum == 1) { return idAsString(); // 4-character ASCII string (e.g. GPS, USNO) } // in NTPv4 servers this is latest transmit timestamp of ref source if (version == VERSION_4) return idAsHex(); } // Stratum 2 and higher this is a four-octet IPv4 address // of the primary reference host. if (stratum >= 2) { return idAsIPAddress(); } return idAsHex(); }
/*** * Returns details of NTP packet as a string. * * @return details of NTP packet as a string. */ @Override public String toString() { return "[" + "version:" + getVersion() + ", mode:" + getMode() + ", poll:" + getPoll() + ", precision:" + getPrecision() + ", delay:" + getRootDelay() + ", dispersion(ms):" + getRootDispersionInMillisDouble() + ", id:" + getReferenceIdString() + ", xmitTime:" + getTransmitTimeStamp().toDateString() + " ]"; }
/*** * Returns details of NTP packet as a string. * * @return details of NTP packet as a string. */ public String toString() { return "[" + "version:" + getVersion() + ", mode:" + getMode() + ", poll:" + getPoll() + ", precision:" + getPrecision() + ", delay:" + getRootDelay() + ", dispersion(ms):" + getRootDispersionInMillisDouble() + ", id:" + getReferenceIdString() + ", xmitTime:" + getTransmitTimeStamp().toDateString() + " ]"; }