summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-07-16 13:37:30 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-07-16 13:37:30 +0200
commit3499416f0785923f40afe0478598c157c9fa00e2 (patch)
treeebe7d11296af0f3e90af6711794a4ceb5009a285 /config.c
parentc39ec5082656aef2cd02e1f295884811554630ac (diff)
downloadvdr-3499416f0785923f40afe0478598c157c9fa00e2.tar.gz
vdr-3499416f0785923f40afe0478598c157c9fa00e2.tar.bz2
Using 'Priority' when checking for timer matches
Diffstat (limited to 'config.c')
-rw-r--r--config.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/config.c b/config.c
index 32fa17f9..30bb74b6 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.9 2000/07/15 16:35:18 kls Exp $
+ * $Id: config.c 1.10 2000/07/16 11:47:30 kls Exp $
*/
#include "config.h"
@@ -339,10 +339,11 @@ bool cTimer::IsSingleEvent(void)
return (day & 0x80000000) == 0;
}
-bool cTimer::Matches(void)
+bool cTimer::Matches(time_t t)
{
if (active) {
- time_t t = time(NULL);
+ if (t == 0)
+ t = time(NULL);
struct tm now = *localtime(&t);
int weekday = now.tm_wday == 0 ? 6 : now.tm_wday - 1; // we start with monday==0!
int begin = TimeToInt(start);
@@ -399,13 +400,17 @@ void cTimer::SetRecording(bool Recording)
cTimer *cTimer::GetMatch(void)
{
- cTimer *t = (cTimer *)Timers.First();
- while (t) {
- if (!t->recording && t->Matches())
- return t;
- t = (cTimer *)t->Next();
+ time_t t = time(NULL); // all timers must be checked against the exact same time to correctly handle Priority!
+ cTimer *t0 = NULL;
+ cTimer *ti = (cTimer *)Timers.First();
+ while (ti) {
+ if (!ti->recording && ti->Matches(t)) {
+ if (!t0 || ti->priority > t0->priority)
+ t0 = ti;
+ }
+ ti = (cTimer *)ti->Next();
}
- return NULL;
+ return t0;
}
// -- cKeys ------------------------------------------------------------------