public class NtpUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
NTP_ATTEMPTS_PROPERTY
Property to set the NTP attempts.
|
static int |
NTP_DEFAULT_ATTEMPTS
Default NTP attempts.
|
static int |
NTP_DEFAULT_PORT
Default ntp port.
|
static String |
NTP_DEFAULT_SERVER
Default NTP url.
|
static int |
NTP_DEFAULT_TIMEOUT
Default NTP timeout.
|
static String |
NTP_PORT_PROPERTY
Property to set the NTP port.
|
static String |
NTP_TIMEOUT_PROPERTY
Property to set the NTP timeout.
|
static String |
NTP_URL_PROPERTY
Property to set the NTP URL.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
updateLocalTime()
Updates the local time.
|
static void |
updateLocalTime(String url,
int port,
int timeout)
Updates the local time.
|
public static final String NTP_ATTEMPTS_PROPERTY
public static final int NTP_DEFAULT_ATTEMPTS
public static final int NTP_DEFAULT_PORT
public static final String NTP_DEFAULT_SERVER
public static final int NTP_DEFAULT_TIMEOUT
public static final String NTP_PORT_PROPERTY
public static final String NTP_TIMEOUT_PROPERTY
public static final String NTP_URL_PROPERTY
public static void updateLocalTime()
throws IOException
IOException - if an error occurred.public static void updateLocalTime(String url, int port, int timeout) throws IOException
url - the ntp server url.port - the ntp server port.timeout - the timeout.IOException - if an error occurred.