1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Improved deleting expired single shot timers

This commit is contained in:
Klaus Schmidinger 2006-03-26 14:38:46 +02:00
parent e789efcb96
commit 5f7e788ae8
3 changed files with 18 additions and 3 deletions

View File

@ -4452,3 +4452,6 @@ Video Disk Recorder Revision History
- The 'running status' of EPG events is now only set to SI::RunningStatusNotRunning - The 'running status' of EPG events is now only set to SI::RunningStatusNotRunning
for events before the present event. for events before the present event.
- Fixed some #include sequences. - Fixed some #include sequences.
- Single shot VPS timers are now only considered 'expired' if their associated
EPG event has been explicitly set to SI::RunningStatusNotRunning.
- The check for timers to be deleted is now done only every 30 seconds.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: timers.c 1.54 2006/03/25 12:43:59 kls Exp $ * $Id: timers.c 1.55 2006/03/26 14:38:46 kls Exp $
*/ */
#include "timers.h" #include "timers.h"
@ -12,6 +12,7 @@
#include "channels.h" #include "channels.h"
#include "device.h" #include "device.h"
#include "i18n.h" #include "i18n.h"
#include "libsi/si.h"
#include "remote.h" #include "remote.h"
// IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d' // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
@ -409,7 +410,13 @@ int cTimer::Matches(const cEvent *Event, int *Overlap) const
bool cTimer::Expired(void) const bool cTimer::Expired(void) const
{ {
return IsSingleEvent() && !Recording() && StopTime() + EXPIRELATENCY <= time(NULL); if (IsSingleEvent() && !Recording() && StopTime() + EXPIRELATENCY <= time(NULL)) {
if (HasFlags(tfVps) && event && event->Vps())
return event->RunningStatus() == SI::RunningStatusNotRunning;
else
return true;
}
return false;
} }
time_t cTimer::StartTime(void) const time_t cTimer::StartTime(void) const
@ -578,6 +585,7 @@ cTimers::cTimers(void)
state = 0; state = 0;
beingEdited = 0;; beingEdited = 0;;
lastSetEvents = 0; lastSetEvents = 0;
lastDeleteExpired = 0;
} }
cTimer *cTimers::GetTimer(cTimer *Timer) cTimer *cTimers::GetTimer(cTimer *Timer)
@ -673,6 +681,8 @@ void cTimers::SetEvents(void)
void cTimers::DeleteExpired(void) void cTimers::DeleteExpired(void)
{ {
if (time(NULL) - lastDeleteExpired < 30)
return;
cTimer *ti = First(); cTimer *ti = First();
while (ti) { while (ti) {
cTimer *next = Next(ti); cTimer *next = Next(ti);
@ -683,4 +693,5 @@ void cTimers::DeleteExpired(void)
} }
ti = next; ti = next;
} }
lastDeleteExpired = time(NULL);
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: timers.h 1.26 2006/02/25 15:05:09 kls Exp $ * $Id: timers.h 1.27 2006/03/26 14:38:46 kls Exp $
*/ */
#ifndef __TIMERS_H #ifndef __TIMERS_H
@ -101,6 +101,7 @@ private:
int state; int state;
int beingEdited; int beingEdited;
time_t lastSetEvents; time_t lastSetEvents;
time_t lastDeleteExpired;
public: public:
cTimers(void); cTimers(void);
cTimer *GetTimer(cTimer *Timer); cTimer *GetTimer(cTimer *Timer);