sectionsd: revert "do not adjtime() if less than one second"

This is actaully not that useful and add unnecessary complexity.
This commit is contained in:
Stefan Seyfried
2016-01-17 16:42:19 +01:00
parent 8e763ca183
commit c4e42e82f0

View File

@@ -1388,7 +1388,6 @@ bool CTimeThread::setSystemTime(time_t tim, bool force)
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
timediff = int64_t(tim * 1000000 - (tv.tv_usec + tv.tv_sec * 1000000)); timediff = int64_t(tim * 1000000 - (tv.tv_usec + tv.tv_sec * 1000000));
localtime_r(&tv.tv_sec, &t); localtime_r(&tv.tv_sec, &t);
int absdiff = abs(tim - tv.tv_sec);
xprintf("%s: timediff %" PRId64 ", current: %02d.%02d.%04d %02d:%02d:%02d, dvb: %s", xprintf("%s: timediff %" PRId64 ", current: %02d.%02d.%04d %02d:%02d:%02d, dvb: %s",
name.c_str(), timediff, name.c_str(), timediff,
@@ -1400,9 +1399,7 @@ bool CTimeThread::setSystemTime(time_t tim, bool force)
return; return;
} }
#endif #endif
if (absdiff < 1) /* do not bother for differences less than one second */ if (timeset && abs(tim - tv.tv_sec) < 120) { /* abs() is int */
return true;
if (absdiff < 120) {
struct timeval oldd; struct timeval oldd;
tv.tv_sec = time_t(timediff / 1000000LL); tv.tv_sec = time_t(timediff / 1000000LL);
tv.tv_usec = suseconds_t(timediff % 1000000LL); tv.tv_usec = suseconds_t(timediff % 1000000LL);