--- vdr-1.3.12-orig/eit.h	2003-12-21 16:51:50.000000000 +0200
+++ vdr-1.3.12/eit.h	2004-10-09 14:41:33.000000000 +0300
@@ -15,8 +15,13 @@
 class cEitFilter : public cFilter {
 protected:
   virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length);
 public:
   cEitFilter(void);
+
+#if 1
+  static char *SetTimeCommand;
+#endif
+
   };
 
 #endif //__EIT_H
--- vdr-1.3.12-orig/vdr.c	2004-06-13 16:52:09.000000000 +0300
+++ vdr-1.3.12/vdr.c	2004-11-18 06:45:12.000000000 +0200
@@ -146,18 +152,21 @@
       { "plugin",   required_argument, NULL, 'P' },
       { "port",     required_argument, NULL, 'p' },
       { "record",   required_argument, NULL, 'r' },
       { "shutdown", required_argument, NULL, 's' },
       { "terminal", required_argument, NULL, 't' },
+#if 1
+      { "settime",  required_argument, NULL, 'T' },
+#endif
       { "version",  no_argument,       NULL, 'V' },
       { "video",    required_argument, NULL, 'v' },
       { "watchdog", required_argument, NULL, 'w' },
       { NULL }
     };
 
   int c;
-  while ((c = getopt_long(argc, argv, "a:c:dD:E:hl:L:mp:P:r:s:t:v:Vw:", long_options, NULL)) != -1) {
+  while ((c = getopt_long(argc, argv, "a:c:dD:E:hl:L:mp:P:r:s:t:T:v:Vw:", long_options, NULL)) != -1) {
         switch (c) {
           case 'a': AudioCommand = optarg;
                     break;
           case 'c': ConfigDirectory = optarg;
                     break;
@@ -222,10 +231,14 @@
                     break;
           case 'r': cRecordingUserCommand::SetCommand(optarg);
                     break;
           case 's': Shutdown = optarg;
                     break;
+#if 1
+          case 'T': cEitFilter::SetTimeCommand = strdup(optarg);
+                    break;
+#endif
           case 't': Terminal = optarg;
                     if (access(Terminal, R_OK | W_OK) < 0) {
                        fprintf(stderr, "vdr: can't access terminal: %s\n", Terminal);
                        return 2;
                        }
@@ -281,10 +294,13 @@
                "                           0 turns off SVDRP\n"
                "  -P OPT,   --plugin=OPT   load a plugin defined by the given options\n"
                "  -r CMD,   --record=CMD   call CMD before and after a recording\n"
                "  -s CMD,   --shutdown=CMD call CMD to shutdown the computer\n"
                "  -t TTY,   --terminal=TTY controlling tty\n"
+#if 1
+	       "  -T CMD,   --settime=CMD  call CMD to set system time\n"
+#endif
                "  -v DIR,   --video=DIR    use DIR as video directory (default: %s)\n"
                "  -V,       --version      print version information and exit\n"
                "  -w SEC,   --watchdog=SEC activate the watchdog timer with a timeout of SEC\n"
                "                           seconds (default: %d); '0' disables the watchdog\n"
                "\n",
--- vdr-1.3.19-orig/eit.c	2005-01-02 13:52:12.000000000 +0200
+++ vdr-1.3.19/eit.c	2005-01-27 17:13:53.557974816 +0200
@@ -256,30 +256,47 @@
 
 class cTDT : public SI::TDT {
 private:
   static cMutex mutex;
 public:
-  cTDT(const u_char *Data);
+  cTDT(const u_char *Data, char *SetTimeCommand = NULL);
   };
 
 cMutex cTDT::mutex;
 
-cTDT::cTDT(const u_char *Data)
+cTDT::cTDT(const u_char *Data, char *SetTimeCommand)
 :SI::TDT(Data, false)
 {
   CheckParse();
 
   time_t sattim = getTime();
   time_t loctim = time(NULL);
 
   if (abs(sattim - loctim) > 2) {
      mutex.Lock();
+#if 1 /* PH */
+     static time_t last = 0;
+     if(SetTimeCommand) {
+       if(loctim-last > 60) {
+	 isyslog("System Time = %s (%ld)\n", ctime(&loctim), loctim);
+	 isyslog("Local Time  = %s (%ld)\n", ctime(&sattim), sattim);
+	 char tmp[1024];
+         sprintf(tmp,"%s %d", SetTimeCommand, (int)sattim);
+         system(tmp);
+         last = loctim;
+       }
+     } else {
+fprintf(stderr,"set sys time NO PROGRAM SET\n");
+#endif
      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();
+#if 1
+     }
+#endif
      }
 }
 
 // --- cEitFilter ------------------------------------------------------------
 
@@ -289,10 +306,12 @@
   Set(0x12, 0x50, 0xF0);  // event info, actual TS, schedule(0x50)/schedule for future days(0x5X)
   Set(0x12, 0x60, 0xF0);  // event info, other  TS, schedule(0x60)/schedule for future days(0x6X)
   Set(0x14, 0x70);        // TDT
 }
 
+char *cEitFilter::SetTimeCommand = NULL;
+
 void cEitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
 {
   switch (Pid) {
     case 0x12: {
          cSchedulesLock SchedulesLock(true, 10);
@@ -301,10 +320,10 @@
             cEIT EIT(Schedules, Source(), Tid, Data);
          }
          break;
     case 0x14: {
          if (Setup.SetSystemTime && Setup.TimeTransponder && ISTRANSPONDER(Transponder(), Setup.TimeTransponder))
-            cTDT TDT(Data);
+            cTDT TDT(Data, SetTimeCommand);
          }
          break;
     }
 }
