--- vdr-1.3.11-unpatched/eit.c	Sun Jun  6 16:49:45 2004
+++ vdr-1.3.11/eit.c	Sat Jul 17 07:24:21 2004
@@ -17,6 +17,8 @@
 #include "libsi/section.h"
 #include "libsi/descriptor.h"
 
+extern char *SetTime;
+
 // --- cEIT ------------------------------------------------------------------
 
 class cEIT : public SI::EIT {
@@ -239,13 +241,27 @@
 
   time_t sattim = getTime();
   time_t loctim = time(NULL);
+  
+  char *cmd;
+  char timestr[20];
+  struct tm *ptm;
+  struct tm tm_r;
+  ptm = localtime_r(&sattim, &tm_r);
 
   if (abs(sattim - loctim) > 2) {
      mutex.Lock();
      isyslog("System Time = %s (%ld)\n", ctime(&loctim), loctim);
      isyslog("Local Time  = %s (%ld)\n", ctime(&sattim), sattim);
-     if (stime(&sattim) < 0)
-        esyslog("ERROR while setting system time: %m");
+     if ( SetTime ) {
+       strftime(timestr,20,"%m%d%H%M%Y.%S",ptm);
+       asprintf(&cmd,"%s %s %ld",SetTime,timestr,sattim);
+       dsyslog("Executing: %s",cmd);
+       SystemExec(cmd);
+       free(cmd);
+     } else {
+       if (stime(&sattim) < 0)
+         esyslog("ERROR while setting system time: %m");
+     }
      mutex.Unlock();
      }
 }
--- vdr-1.3.11-unpatched/vdr.c	Sun Jun 13 15:52:09 2004
+++ vdr-1.3.11/vdr.c	Sat Jul 17 07:13:15 2004
@@ -65,6 +65,8 @@
 
 static int Interrupted = 0;
 
+char *SetTime=NULL;
+
 static void SignalHandler(int signum)
 {
   if (signum != SIGPIPE) {
@@ -148,6 +150,7 @@
       { "record",   required_argument, NULL, 'r' },
       { "shutdown", required_argument, NULL, 's' },
       { "terminal", required_argument, NULL, 't' },
+      { "timeset",  required_argument, NULL, 'T' },
       { "version",  no_argument,       NULL, 'V' },
       { "video",    required_argument, NULL, 'v' },
       { "watchdog", required_argument, NULL, 'w' },
@@ -155,7 +158,7 @@
     };
 
   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;
@@ -224,6 +227,8 @@
                     break;
           case 's': Shutdown = optarg;
                     break;
+          case 'T': SetTime = strdup(optarg);
+                    break;
           case 't': Terminal = optarg;
                     if (access(Terminal, R_OK | W_OK) < 0) {
                        fprintf(stderr, "vdr: can't access terminal: %s\n", Terminal);
