[vdr] [PATCH] time warp

Birgit & Andreas Böttger fboettger at t-online.de
Sat Jun 18 19:20:39 CEST 2005


Hi all,

I use the nice "set system time" feature of vdr.
But sometimes vdr seems to read gabage time from DVB,
jumps through the time and miss out timers.
To avoid souch time warping, I use the assumption,
that garbage values never be the same twice:

eit.c, line 261 ff.
----------------------------------------------------------------------
cTDT::cTDT(const u_char *Data)
:SI::TDT(Data, false)
{
   CheckParse();

   time_t sattim = getTime();
   time_t loctim = time(NULL);

   static int lastDiff = 0;
   int diff = abs(sattim - loctim);
   if (diff > 2) {
      if (abs(diff - lastDiff) < 3) {
         mutex.Lock();
         isyslog("System Time = %s (%ld)\n",
                 *TimeToString(loctim), loctim);
         isyslog("Local Time  = %s (%ld)\n",
                 *TimeToString(sattim), sattim);
         if (stime(&sattim) < 0)
            esyslog("ERROR while setting system time: %m");
         mutex.Unlock();
      } else {
         isyslog("diff = %d, ignored to avoid time warp :)", diff);
      }
      lastDiff = diff;
   }
}
----------------------------------------------------------------------

Kind regards
Andreas Böttger



More information about the vdr mailing list