From 2dc3a3d399f7315df034c13fc63dc097683f1f97 Mon Sep 17 00:00:00 2001
From: Klaus Schmidinger <vdr@tvdr.de>
Date: Sun, 7 Mar 2004 11:53:43 +0100
Subject: Fixed handling VPS times at year boundaries

---
 HISTORY | 1 +
 eit.c   | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/HISTORY b/HISTORY
index 9a87b8ca..7d2db65b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2727,3 +2727,4 @@ Video Disk Recorder Revision History
   the running status).
 - Fixed handling "itemized" texts in EPG data (thanks to St�phane Est�-Gracias
   for pointing out this problem, and Marcel Wiesweg for improving 'libsi').
+- Fixed handling VPS times at year boundaries.
diff --git a/eit.c b/eit.c
index 59a8a867..177ef310 100644
--- a/eit.c
+++ b/eit.c
@@ -8,7 +8,7 @@
  * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
  * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
  *
- * $Id: eit.c 1.91 2004/03/07 10:36:57 kls Exp $
+ * $Id: eit.c 1.92 2004/03/07 11:51:57 kls Exp $
  */
 
 #include "eit.h"
@@ -126,11 +126,16 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
                  struct tm tm_r;
                  struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't'
                  t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
+                 int month = t.tm_mon;
                  t.tm_mon = pd->getMonth() - 1;
                  t.tm_mday = pd->getDay();
                  t.tm_hour = pd->getHour();
                  t.tm_min = pd->getMinute();
                  t.tm_sec = 0;
+                 if (month == 11 && t.tm_mon == 0) // current month is dec, but event is in jan
+                    t.tm_year++;
+                 else if (month == 0 && t.tm_mon == 11) // current month is jan, but event is in dec
+                    t.tm_year--;
                  time_t vps = mktime(&t);
                  pEvent->SetVps(vps);
                  }
-- 
cgit v1.2.3