Class NtpUtils


  • public final class NtpUtils
    extends java.lang.Object
    Common NtpUtils Helper class.
    Version:
    $Revision: 1652855 $
    • Constructor Summary

      Constructors 
      Constructor Description
      NtpUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getHostAddress​(int address)
      Returns 32-bit integer address to IPv4 address string "%d.%d.%d.%d" format.
      static java.lang.String getModeName​(int mode)
      Return human-readable name of message mode type (RFC 1305).
      static java.lang.String getRefAddress​(NtpV3Packet packet)
      Returns NTP packet reference identifier as IP address.
      static java.lang.String getReferenceClock​(NtpV3Packet message)
      Get refId as reference clock string (e.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NtpUtils

        public NtpUtils()
    • Method Detail

      • getHostAddress

        public static java.lang.String getHostAddress​(int address)
        Returns 32-bit integer address to IPv4 address string "%d.%d.%d.%d" format.
        Parameters:
        address - the 32-bit address
        Returns:
        the raw IP address in a string format.
      • getRefAddress

        public static java.lang.String getRefAddress​(NtpV3Packet packet)
        Returns NTP packet reference identifier as IP address.
        Parameters:
        packet - NTP packet
        Returns:
        the packet reference id (as IP address) in "%d.%d.%d.%d" format.
      • getReferenceClock

        public static java.lang.String getReferenceClock​(NtpV3Packet message)
        Get refId as reference clock string (e.g. GPS, WWV, LCL). If string is invalid (non-ASCII character) then returns empty string "". For details refer to the Comprehensive List of Clock Drivers.
        Parameters:
        message - the message to check
        Returns:
        reference clock string if primary NTP server
      • getModeName

        public static java.lang.String getModeName​(int mode)
        Return human-readable name of message mode type (RFC 1305).
        Parameters:
        mode - the mode type
        Returns:
        mode name