Class NTPClient


  • public final class NTPClient
    extends java.lang.Object
    This is an example program demonstrating how to use the NTPUDPClient class. This program sends a Datagram client request packet to a Network time Protocol (NTP) service port on a specified server, retrieves the time, and prints it to standard output along with the fields from the NTP message header (e.g. stratum level, reference id, poll interval, root delay, mode, ...) See the spec for details.

    Usage: NTPClient

    Example: NTPClient clock.psu.edu

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.text.NumberFormat numberFormat  
    • Constructor Summary

      Constructors 
      Constructor Description
      NTPClient()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String[] args)  
      static void processResponse​(TimeInfo info)
      Process TimeInfo object and print its details.
      • Methods inherited from class java.lang.Object

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

      • numberFormat

        private static final java.text.NumberFormat numberFormat
    • Constructor Detail

      • NTPClient

        public NTPClient()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
      • processResponse

        public static void processResponse​(TimeInfo info)
        Process TimeInfo object and print its details.
        Parameters:
        info - TimeInfo object.