[vdr] [PATCH] time warp

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Sun Jun 19 11:18:49 CEST 2005


Birgit & Andreas Böttger wrote:
> Hi all,
> 
> I use the nice "set system time" feature of vdr.
> But sometimes vdr seems to read gabage time from DVB,

Isn't all that data protected by CRC32 checksums?
How could "garbage" get in there?

Maybe somebody should try to find out why that "garbage"
is produced in the first place...

> 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;
>   }
> }
> ----------------------------------------------------------------------



More information about the vdr mailing list