summaryrefslogtreecommitdiff
path: root/timers.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2017-11-12 13:13:06 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2017-11-12 13:13:06 +0100
commit8dcff164fa3374fa88263d6b11b33fa48d30dade (patch)
treecf1c6dabe5b1161677d2cf137e1d193d7796af5a /timers.c
parent54b721ebde9c3735a322f13f0e6e7ca24f0c1794 (diff)
downloadvdr-8dcff164fa3374fa88263d6b11b33fa48d30dade.tar.gz
vdr-8dcff164fa3374fa88263d6b11b33fa48d30dade.tar.bz2
Fixed handling timers during the change from DST to winter time
Diffstat (limited to 'timers.c')
-rw-r--r--timers.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/timers.c b/timers.c
index 6859eece..9d28f922 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 4.13 2017/11/09 12:10:46 kls Exp $
+ * $Id: timers.c 4.14 2017/11/12 13:01:22 kls Exp $
*/
#include "timers.h"
@@ -419,20 +419,25 @@ bool cTimer::Matches(time_t t, bool Directly, int Margin) const
t = time(NULL);
int begin = TimeToInt(start); // seconds from midnight
- int length = TimeToInt(stop) - begin;
- if (length < 0)
- length += SECSINDAY;
+ int end = TimeToInt(stop);
+ int length = end - begin;
if (IsSingleEvent()) {
- startTime = SetTime(day, begin);
- stopTime = startTime + length;
+ time_t t0 = day;
+ startTime = SetTime(t0, begin);
+ if (length < 0)
+ t0 = IncDay(day, 1);
+ stopTime = SetTime(t0, end);
}
else {
+ time_t d = day ? max(day, t) : t;
for (int i = -1; i <= 7; i++) {
- time_t t0 = IncDay(day ? max(day, t) : t, i);
+ time_t t0 = IncDay(d, i);
if (DayMatches(t0)) {
time_t a = SetTime(t0, begin);
- time_t b = a + length;
+ if (length < 0)
+ t0 = IncDay(d, i + 1);
+ time_t b = SetTime(t0, end);
if ((!day || a >= day) && t < b) {
startTime = a;
stopTime = b;