From 7e09fd087a82abbc6e818d36f699de478a01f812 Mon Sep 17 00:00:00 2001
From: Chris Tallon <chris@vomp.tv>
Date: Sun, 26 Feb 2006 20:22:34 +0000
Subject: [PATCH] *** empty log message ***

---
 mvpclient.c | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/mvpclient.c b/mvpclient.c
index abd9154..4efce3c 100644
--- a/mvpclient.c
+++ b/mvpclient.c
@@ -1256,8 +1256,43 @@ int MVPClient::processGetTimers(UCHAR* buffer, int length)
 
 int MVPClient::processSetTimer(UCHAR* buffer, int length)
 {
+  char* timerString = new char[strlen((char*)buffer) + 1];
+  strcpy(timerString, (char*)buffer);
+
+#if VDRVERSNUM < 10300
+
+  // If this is VDR 1.2 the date part of the timer string must be reduced
+  // to just DD rather than YYYY-MM-DD
+
+  int s = 0; // source
+  int d = 0; // destination
+  int c = 0; // count
+  while(c != 2) // copy up to date section, including the second ':'
+  {
+    timerString[d] = buffer[s];
+    if (buffer[s] == ':') c++;
+    ++s;
+    ++d;
+  }
+  // now it has copied up to the date section
+  c = 0;
+  while(c != 2) // waste YYYY-MM-
+  {
+    if (buffer[s] == '-') c++;
+    ++s;
+  }
+  // now source is at the DD
+  memcpy(&timerString[d], &buffer[s], length - s);
+  d += length - s;
+  timerString[d] = '\0';
+
+  log->log("Client", Log::DEBUG, "Timer string after 1.2 conversion:");
+  log->log("Client", Log::DEBUG, "%s", timerString);
+
+#endif
+
   cTimer *timer = new cTimer;
-  if (timer->Parse((char*)buffer))
+  if (timer->Parse((char*)timerString))
   {
     cTimer *t = Timers.GetTimer(timer);
     if (!t)
-- 
2.39.5