diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2002-04-01 11:04:47 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2002-04-01 11:04:47 +0200 |
commit | 5e4834e737c93f9d083c536b2da4398479ace8f4 (patch) | |
tree | d83f57bb16867db3e345bf15cda80bd2a378f646 /config.c | |
parent | a09bc76955c81a0c0dcd68216823305be724494b (diff) | |
download | vdr-5e4834e737c93f9d083c536b2da4398479ace8f4.tar.gz vdr-5e4834e737c93f9d083c536b2da4398479ace8f4.tar.bz2 |
Fixed a bug when a timer records over midnight of a day that had a change in Daylight Saving Time
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.94 2002/03/31 21:17:24 kls Exp $ + * $Id: config.c 1.95 2002/04/01 10:54:32 kls Exp $ */ #include "config.h" @@ -439,6 +439,7 @@ int cTimer::ParseDay(const char *s, time_t *FirstDay) tm_r.tm_year -= 1900; tm_r.tm_mon--; tm_r.tm_hour = tm_r.tm_min = tm_r.tm_sec = 0; + tm_r.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting *FirstDay = mktime(&tm_r); } } @@ -560,6 +561,7 @@ time_t cTimer::IncDay(time_t t, int Days) tm tm = *localtime_r(&t, &tm_r); tm.tm_mday += Days; // now tm_mday may be out of its valid range int h = tm.tm_hour; // save original hour to compensate for DST change + tm.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting t = mktime(&tm); // normalize all values tm.tm_hour = h; // compensate for DST change return mktime(&tm); // calculate final result @@ -572,6 +574,7 @@ time_t cTimer::SetTime(time_t t, int SecondsFromMidnight) tm.tm_hour = SecondsFromMidnight / 3600; tm.tm_min = (SecondsFromMidnight % 3600) / 60; tm.tm_sec = SecondsFromMidnight % 60; + tm.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting return mktime(&tm); } |