sectionsd: be more tolerant about adjtime() failure

This commit is contained in:
Stefan Seyfried
2013-03-05 19:49:21 +01:00
parent d558218115
commit fc3aa5949f

View File

@@ -1342,11 +1342,13 @@ void CTimeThread::setSystemTime(time_t tim)
tv.tv_sec = timediff / 1000000LL; tv.tv_sec = timediff / 1000000LL;
tv.tv_usec = timediff % 1000000LL; tv.tv_usec = timediff % 1000000LL;
if (adjtime(&tv, &oldd)) if (adjtime(&tv, &oldd))
perror("adjtime"); xprintf("adjtime(%d, %d) failed: %m\n", (int)tv.tv_sec, (int)tv.tv_usec);
xprintf("difference is < 120s, using adjtime(%d, %d). oldd(%d, %d)\n", else {
(int)tv.tv_sec, (int)tv.tv_usec, (int)oldd.tv_sec, (int)oldd.tv_usec); xprintf("difference is < 120s, using adjtime(%d, %d). oldd(%d, %d)\n",
timediff = 0; (int)tv.tv_sec, (int)tv.tv_usec, (int)oldd.tv_sec, (int)oldd.tv_usec);
return; timediff = 0;
return;
}
} }
tv.tv_sec = tim; tv.tv_sec = tim;