Fixed a bug when a timer records over midnight of a day that had a change in Daylight Saving Time

This commit is contained in:
Klaus Schmidinger 2002-04-01 11:04:47 +02:00
parent a09bc76955
commit 5e4834e737
3 changed files with 9 additions and 4 deletions

View File

@ -1120,7 +1120,7 @@ Video Disk Recorder Revision History
exits. The 'runvdr' script can be used for this purpose.
- Refined texts of the "Setup" menu.
2002-03-29: Version 1.0.0pre5
2002-04-01: Version 1.0.0pre5
- Fixed restoring CICAM setup values for a fourth DVB card (thanks to Klaus Wolf).
- Completed internationalization of OSD texts (thanks to Hannu Savolainen,
@ -1159,3 +1159,5 @@ Video Disk Recorder Revision History
the use of an external 'df' command (thanks to Ruben Nunez Francisco).
- Fixed skipping the next hit of a repeating timer (thanks to Rainer Zocholl
for reporting this one).
- Fixed a bug when a timer records over midnight of a day that had a change in
Daylight Saving Time.

View File

@ -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);
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 1.59 2002/03/23 16:15:32 kls Exp $
* $Id: recording.c 1.60 2002/04/01 10:51:23 kls Exp $
*/
#include "recording.h"
@ -343,7 +343,7 @@ cRecording::cRecording(const char *FileName)
time_t now = time(NULL);
struct tm tm_r;
struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't'
t.tm_isdst = -1; // makes sure mktime() will determine the correct dst setting
t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
if (7 == sscanf(p + 1, DATAFORMAT, &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &priority, &lifetime)) {
t.tm_year -= 1900;
t.tm_mon--;