summaryrefslogtreecommitdiff
path: root/epg.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-03-06 11:27:08 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2004-03-06 11:27:08 +0100
commit18d3851b72d35b6c658dd1fb71acff1a88c2c58a (patch)
tree72cb249c33c548391c058481d4b214b269054aa7 /epg.c
parentb845ef01b56c18cab44c3992fd6cae9af2f6467a (diff)
downloadvdr-18d3851b72d35b6c658dd1fb71acff1a88c2c58a.tar.gz
vdr-18d3851b72d35b6c658dd1fb71acff1a88c2c58a.tar.bz2
Fixed assigning events to timers (they no longer get "stuck")
Diffstat (limited to 'epg.c')
-rw-r--r--epg.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/epg.c b/epg.c
index be378c09..b979256c 100644
--- a/epg.c
+++ b/epg.c
@@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
- * $Id: epg.c 1.14 2004/02/29 13:48:34 kls Exp $
+ * $Id: epg.c 1.15 2004/03/06 10:12:50 kls Exp $
*/
#include "epg.h"
@@ -105,6 +105,11 @@ bool cEvent::HasTimer(void) const
return false;
}
+bool cEvent::IsRunning(bool OrAboutToStart) const
+{
+ return runningStatus >= (OrAboutToStart ? SI::RunningStatusStartsInAFewSeconds : SI::RunningStatusPausing);
+}
+
const char *cEvent::GetDateString(void) const
{
static char buf[25];
@@ -475,7 +480,7 @@ const cEvent *cSchedule::GetPresentEvent(bool CheckRunningStatus) const
const cEvent *pe = NULL;
time_t now = time(NULL);
for (cEvent *p = events.First(); p; p = events.Next(p)) {
- if (p->StartTime() <= now && now < p->StartTime() + p->Duration()) {
+ if (p->StartTime() <= now && now < p->EndTime()) {
pe = p;
if (!CheckRunningStatus)
break;
@@ -514,7 +519,7 @@ const cEvent *cSchedule::GetEventAround(time_t Time) const
time_t delta = INT_MAX;
for (cEvent *p = events.First(); p; p = events.Next(p)) {
time_t dt = Time - p->StartTime();
- if (dt >= 0 && dt < delta && p->StartTime() + p->Duration() >= Time) {
+ if (dt >= 0 && dt < delta && p->EndTime() >= Time) {
delta = dt;
pe = p;
}
@@ -555,7 +560,7 @@ void cSchedule::Cleanup(time_t Time)
Event = events.Get(a);
if (!Event)
break;
- if (!Event->HasTimer() && Event->StartTime() + Event->Duration() + Setup.EPGLinger * 60 + 3600 < Time) { // adding one hour for safety
+ if (!Event->HasTimer() && Event->EndTime() + Setup.EPGLinger * 60 + 3600 < Time) { // adding one hour for safety
events.Del(Event);
a--;
}