From patchwork Sun Jun 26 07:54:23 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Birgit_=26_Andreas_B=C3=B6ttger?= X-Patchwork-Id: 11922 Received: from mailout03.sul.t-online.com ([194.25.134.81]) by www.linuxtv.org with esmtp (Exim 4.34) id 1DmRyV-0003Vu-HA for vdr@linuxtv.org; Sun, 26 Jun 2005 09:54:43 +0200 Received: from fwd18.aul.t-online.de by mailout03.sul.t-online.com with smtp id 1DmRyT-0004eQ-00; Sun, 26 Jun 2005 09:54:41 +0200 Received: from [10.0.0.12] (rfeyyqZE8eMNJ1K3dfllxNoJSyU2mJHrS8Kyjn4cRbrfoWNzHerUkH@[84.180.114.122]) by fwd18.sul.t-online.de with esmtp id 1DmRyE-28QQHA0; Sun, 26 Jun 2005 09:54:26 +0200 Message-ID: <42BE5F2F.2070201@t-online.de> Date: Sun, 26 Jun 2005 09:54:23 +0200 From: =?ISO-8859-1?Q?Birgit_=26_Andreas_B=F6ttger?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.5) Gecko/20041217 X-Accept-Language: de, de-at, en-us, en MIME-Version: 1.0 To: Klaus Schmidinger's VDR Subject: Re: [vdr] [PATCH] time warp References: <42B457E7.9040501@t-online.de> <42B53879.7000507@cadsoft.de> <42BE0822.9050202@gmx.de> In-Reply-To: <42BE0822.9050202@gmx.de> X-ID: rfeyyqZE8eMNJ1K3dfllxNoJSyU2mJHrS8Kyjn4cRbrfoWNzHerUkH X-TOI-MSGID: 94589820-335d-4a47-90ea-543f5203c8ac X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2005 07:54:43 -0000 Status: O X-Status: X-Keywords: X-UID: 3247 Udo Richter schrieb: >>>I use the nice "set system time" feature of vdr. >>>But sometimes vdr seems to read gabage time from DVB, > > I hereby vote to fix this. I lost a recording today because of time > errors. After some tests with other transponders, I currently use RTL again to set system time, because this is the most used transponder here. Sometimes there are "garbage times", but this is no problem any longer :) Jun 24 09:25:16 vdr vdr[20898]: diff = 86398, ignored to avoid time warp :) Jun 24 09:33:38 vdr vdr[20898]: diff = 1047043634, ignored to avoid time warp :) Jun 24 09:33:47 vdr vdr[20898]: diff = 5038, ignored to avoid time warp :) Jun 24 09:42:10 vdr vdr[20898]: diff = 49262, ignored to avoid time warp :) Jun 24 09:50:33 vdr vdr[20898]: diff = 1322, ignored to avoid time warp :) Jun 24 10:33:29 vdr vdr[20898]: diff = 2843878, ignored to avoid time warp :) Jun 24 10:33:31 vdr vdr[20898]: diff = 3314218, ignored to avoid time warp :) Jun 24 10:50:36 vdr vdr[20898]: diff = 1742, ignored to avoid time warp :) Jun 24 10:58:52 vdr vdr[20898]: diff = 528958, ignored to avoid time warp :) Jun 24 10:58:56 vdr vdr[20898]: diff = 2132884262, ignored to avoid time warp :) Jun 24 11:15:47 vdr vdr[20898]: diff = 9461758, ignored to avoid time warp :) Jun 24 11:24:11 vdr vdr[20898]: diff = 22082, ignored to avoid time warp :) Jun 24 16:00:54 vdr vdr[11790]: diff = 1916301377, ignored to avoid time warp :) Jun 24 16:17:48 vdr vdr[11790]: diff = 1744739819, ignored to avoid time warp :) Jun 24 17:08:13 vdr vdr[11790]: diff = 145784339, ignored to avoid time warp :) Jun 24 17:24:55 vdr vdr[11790]: diff = 179202481, ignored to avoid time warp :) Jun 24 17:41:52 vdr vdr[11790]: diff = 1618607957, ignored to avoid time warp :) Jun 25 11:53:46 vdr vdr[7595]: diff = 9153240, ignored to avoid time warp :) Jun 25 12:52:28 vdr vdr[7595]: diff = 3000, ignored to avoid time warp :) Jun 25 13:09:24 vdr vdr[7595]: diff = 4380, ignored to avoid time warp :) Jun 25 13:31:05 vdr vdr[7595]: diff = 3017820, ignored to avoid time warp :) Jun 25 13:47:48 vdr vdr[7595]: diff = 5160, ignored to avoid time warp :) Jun 25 14:04:47 vdr vdr[7595]: diff = 5441340, ignored to avoid time warp :) Jun 25 14:55:18 vdr vdr[7595]: diff = 1119704119, ignored to avoid time warp :) Jun 25 16:16:53 vdr vdr[7595]: diff = 311639, ignored to avoid time warp :) Jun 25 16:58:58 vdr vdr[7595]: diff = 2281, ignored to avoid time warp :) Jun 25 16:59:05 vdr vdr[7595]: diff = 69059, ignored to avoid time warp :) Jun 25 17:15:54 vdr vdr[7595]: diff = 8399, ignored to avoid time warp :) To help you, I have attached a patch against vdr-1.3.27. This patch should also work with older versions of vdr. Go to the VDR directory and type: patch < vdr-1.3.27_time_warp.diff Kind regards Andreas Böttger diff -Nur vdr-1.3.27.ori/eit.c vdr-1.3.27/eit.c --- vdr-1.3.27.ori/eit.c 2005-06-11 17:31:21.000000000 +0200 +++ vdr-1.3.27/eit.c 2005-06-25 09:23:57.000000000 +0200 @@ -266,14 +266,21 @@ time_t sattim = getTime(); time_t loctim = time(NULL); - if (abs(sattim - loctim) > 2) { - 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(); + 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; + } }