summaryrefslogtreecommitdiff
path: root/timers.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-11-21 13:28:05 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2004-11-21 13:28:05 +0100
commitc2daf37ed136f85dd94cfd6cfa670aba9d93193c (patch)
treec4ff721ed234d1f90900c60078458ec0faeb9ec0 /timers.c
parent969864aacbe593fb237aa173f68eb61f859e8e66 (diff)
downloadvdr-c2daf37ed136f85dd94cfd6cfa670aba9d93193c.tar.gz
vdr-c2daf37ed136f85dd94cfd6cfa670aba9d93193c.tar.bz2
Fixed toggling the 'Day' item in the 'Timers' menu, so that it selects the right day of week for timers in the future
Diffstat (limited to 'timers.c')
-rw-r--r--timers.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/timers.c b/timers.c
index 501396ee..62f59d84 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.17 2004/11/14 16:02:42 kls Exp $
+ * $Id: timers.c 1.18 2004/11/21 13:15:33 kls Exp $
*/
#include "timers.h"
@@ -269,6 +269,18 @@ int cTimer::GetWDay(time_t t)
return weekday == 0 ? 6 : weekday - 1; // we start with monday==0!
}
+int cTimer::GetWDayFromMDay(int MDay)
+{
+ time_t now = time(NULL);
+ int md = GetMDay(now);
+ for (int i = -1; i <= 28; i++) { // looking 4 weeks into the future should be enough
+ time_t t0 = IncDay(now, i);
+ if (GetMDay(t0) == MDay)
+ return GetWDay(t0);
+ }
+ return GetWDay(now); // just to return something
+}
+
bool cTimer::DayMatches(time_t t) const
{
return IsSingleEvent() ? GetMDay(t) == day : (day & (1 << GetWDay(t))) != 0;