diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2004-11-21 13:28:05 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2004-11-21 13:28:05 +0100 |
commit | c2daf37ed136f85dd94cfd6cfa670aba9d93193c (patch) | |
tree | c4ff721ed234d1f90900c60078458ec0faeb9ec0 /timers.c | |
parent | 969864aacbe593fb237aa173f68eb61f859e8e66 (diff) | |
download | vdr-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.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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; |