public class NtpUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NTP_ATTEMPTS_PROPERTY
Property to set the NTP attempts.
|
static int |
NTP_DEFAULT_ATTEMPTS
Default NTP attempts.
|
static int |
NTP_DEFAULT_GUARD_TIME
Default NTP guard time.
|
static int |
NTP_DEFAULT_PORT
Default NTP port.
|
static java.lang.String |
NTP_DEFAULT_SERVER
Default NTP URL.
|
static int |
NTP_DEFAULT_TIMEOUT
Default NTP timeout.
|
static java.lang.String |
NTP_GUARD_TIME_PROPERTY
Property to set the NTP guard time.
|
static java.lang.String |
NTP_PORT_PROPERTY
Property to set the NTP port.
|
static java.lang.String |
NTP_TIMEOUT_PROPERTY
Property to set the NTP timeout.
|
static java.lang.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(java.lang.String url,
int port,
int timeout)
Updates the local time.
|
public static final java.lang.String NTP_URL_PROPERTY
public static final java.lang.String NTP_PORT_PROPERTY
public static final java.lang.String NTP_TIMEOUT_PROPERTY
public static final java.lang.String NTP_ATTEMPTS_PROPERTY
public static final java.lang.String NTP_GUARD_TIME_PROPERTY
public static final int NTP_DEFAULT_PORT
public static final java.lang.String NTP_DEFAULT_SERVER
public static final int NTP_DEFAULT_TIMEOUT
public static final int NTP_DEFAULT_ATTEMPTS
public static final int NTP_DEFAULT_GUARD_TIME
public static void updateLocalTime() throws java.io.IOException
java.io.IOException
- if an error occurred.public static void updateLocalTime(java.lang.String url, int port, int timeout) throws java.io.IOException
When this method returns, the application time is updated.
url
- the NTP server URL.port
- the NTP server port.timeout
- the timeout for one NTP request.java.io.IOException
- if an error occurred.Util.currentTimeMillis()