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:
Andrew Johnson
2009-04-20 22:21:45 +00:00
parent 1bbeeb1c87
commit b1234b4667
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -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)
+2 -2
View File
@@ -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));