Modified the timeout and retry count: Allow 4 seconds for an NTP reply,
and 4 retries, thus NTP sync must work at least once every 5 minutes.
This commit is contained in:
@@ -42,7 +42,9 @@ static int done = timeRegister();
|
||||
|
||||
int osdNTPGet(struct timespec *ts)
|
||||
{
|
||||
return sntpcTimeGet(const_cast<char *>(pserverAddr), sysClkRateGet(), ts);
|
||||
return sntpcTimeGet(const_cast<char *>(pserverAddr),
|
||||
4 * sysClkRateGet(), /* 4 second timeout for NTP request*/
|
||||
ts);
|
||||
}
|
||||
|
||||
void osdNTPInit(void)
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#define NSEC_PER_SEC 1000000000
|
||||
#define NTPTimeSyncInterval 60.0
|
||||
#define NTPTimeSyncRetries 4
|
||||
|
||||
|
||||
static struct {
|
||||
@@ -153,8 +154,7 @@ static void NTPTimeSync(void *dummy)
|
||||
tickNow = osdTickGet();
|
||||
|
||||
if (status) {
|
||||
/* Retry before failing */
|
||||
if (++NTPTimePvt.syncsFailed >= 2 &&
|
||||
if (++NTPTimePvt.syncsFailed > NTPTimeSyncRetries &&
|
||||
NTPTimePvt.synchronized) {
|
||||
errlogPrintf("NTPTimeSync: NTP requests failing - %s\n",
|
||||
strerror(errno));
|
||||
|
||||
Reference in New Issue
Block a user