correctly handle no reachable NTP servers
This commit is contained in:
@ -50,13 +50,13 @@ public class Timestamper implements Runnable {
|
|||||||
while (true) {
|
while (true) {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Querying servers " + _serverList);
|
_log.debug("Querying servers " + _serverList);
|
||||||
long now = NtpClient.currentTime(_serverList);
|
try {
|
||||||
if (now < 0) {
|
long now = NtpClient.currentTime(_serverList);
|
||||||
_log.error("Unable to contact any of the NTP servers - network disconnect?");
|
|
||||||
} else {
|
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Stamp time");
|
_log.debug("Stamp time");
|
||||||
stampTime(now);
|
stampTime(now);
|
||||||
|
} catch (IllegalArgumentException iae) {
|
||||||
|
_log.log(Log.CRIT, "Unable to reach any of the NTP servers - network disconnected?");
|
||||||
}
|
}
|
||||||
try { Thread.sleep(DELAY_MS); } catch (InterruptedException ie) {}
|
try { Thread.sleep(DELAY_MS); } catch (InterruptedException ie) {}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user