Package ej.net.util

Class NtpUtil


  • public class NtpUtil
    extends Object
    Utilities to update the local time using NTP.
    • Method Detail

      • updateLocalTime

        public static void updateLocalTime​(String url,
                                           int port,
                                           int timeout)
                                    throws IOException
        Updates the local time.

        When this method returns, the application time is updated.

        Parameters:
        url - the NTP server URL.
        port - the NTP server port.
        timeout - the timeout for one NTP request.
        Throws:
        IOException - if an error occurred.
        See Also:
        Util.currentTimeMillis()