How to use an Internet time server to get the time?

sp0d is not quite right: timeInfo.getReturnTime(); // Returns time at which time message packet was received by local machine So it just returns current system time, not the received one. See TimeInfo man page. You should use timeInfo.getMessage().getTransmitTimeStamp().getTime(); instead. So the code block will be: String TIME_SERVER = “time-a.nist.gov”; NTPUDPClient timeClient = new NTPUDPClient(); InetAddress … Read more