|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.time.NtpClient
public class NtpClient
NtpClient - an NTP client for Java. This program connects to an NTP server and prints the response to the console. The local clock offset calculation is implemented according to the SNTP algorithm specified in RFC 2030. Note that on windows platforms, the curent time-of-day timestamp is limited to an resolution of 10ms and adversely affects the accuracy of the results.
Constructor Summary | |
---|---|
NtpClient()
|
Method Summary | |
---|---|
static long |
currentTime(java.lang.String serverName)
Query the given NTP server, returning the current internet time |
static long |
currentTime(java.lang.String[] serverNames)
Query the ntp servers, returning the current time from first one we find |
static void |
main(java.lang.String[] args)
|
(package private) static void |
printUsage()
Prints usage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NtpClient()
Method Detail |
---|
public static long currentTime(java.lang.String[] serverNames)
java.lang.IllegalArgumentException
- if none of the servers are reachablepublic static long currentTime(java.lang.String serverName)
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
static void printUsage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |