summaryrefslogtreecommitdiff
path: root/timers.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-03-20 11:19:36 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-03-20 11:19:36 +0100
commitce0e97eb6501ecea1c6be45bcc99ce51d34262c9 (patch)
tree1fc0271f185b2b7961463aff2f2eb95c37121936 /timers.c
parente760b14f646004a7fe99e4561156a132a0572cdb (diff)
downloadvdr-ce0e97eb6501ecea1c6be45bcc99ce51d34262c9.tar.gz
vdr-ce0e97eb6501ecea1c6be45bcc99ce51d34262c9.tar.bz2
Single shot timers are now reliably deleted when they have expired
Diffstat (limited to 'timers.c')
-rw-r--r--timers.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/timers.c b/timers.c
index e24fb207..b8e67468 100644
--- a/timers.c
+++ b/timers.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: timers.c 1.25 2005/03/19 15:20:58 kls Exp $
+ * $Id: timers.c 1.26 2005/03/20 11:19:36 kls Exp $
*/
#include "timers.h"
@@ -389,6 +389,13 @@ int cTimer::Matches(const cEvent *Event, int *Overlap)
return tmNone;
}
+#define EXPIRELATENCY 60 // seconds (just in case there's a short glitch in the VPS signal)
+
+bool cTimer::Expired(void)
+{
+ return IsSingleEvent() && !Recording() && StopTime() + EXPIRELATENCY <= time(NULL);
+}
+
time_t cTimer::StartTime(void) const
{
if (!startTime)
@@ -604,3 +611,17 @@ void cTimers::SetEvents(void)
}
lastSetEvents = time(NULL);
}
+
+void cTimers::DeleteExpired(void)
+{
+ cTimer *ti = First();
+ while (ti) {
+ cTimer *next = Next(ti);
+ if (ti->Expired()) {
+ isyslog("deleting timer %d", ti->Index() + 1);
+ Del(ti);
+ SetModified();
+ }
+ ti = next;
+ }
+}