mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Added a mechanism to defer timer handling in case of problems
This commit is contained in:
15
timers.c
15
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 2.4 2010/01/16 11:18:53 kls Exp $
|
||||
* $Id: timers.c 2.5 2011/08/06 13:13:54 kls Exp $
|
||||
*/
|
||||
|
||||
#include "timers.h"
|
||||
@@ -29,6 +29,7 @@ cTimer::cTimer(bool Instant, bool Pause, cChannel *Channel)
|
||||
{
|
||||
startTime = stopTime = 0;
|
||||
lastSetEvent = 0;
|
||||
deferred = 0;
|
||||
recording = pending = inVpsMargin = false;
|
||||
flags = tfNone;
|
||||
if (Instant)
|
||||
@@ -62,6 +63,7 @@ cTimer::cTimer(const cEvent *Event)
|
||||
{
|
||||
startTime = stopTime = 0;
|
||||
lastSetEvent = 0;
|
||||
deferred = 0;
|
||||
recording = pending = inVpsMargin = false;
|
||||
flags = tfActive;
|
||||
if (Event->Vps() && Setup.UseVps)
|
||||
@@ -118,6 +120,7 @@ cTimer& cTimer::operator= (const cTimer &Timer)
|
||||
startTime = Timer.startTime;
|
||||
stopTime = Timer.stopTime;
|
||||
lastSetEvent = 0;
|
||||
deferred = 0;
|
||||
recording = Timer.recording;
|
||||
pending = Timer.pending;
|
||||
inVpsMargin = Timer.inVpsMargin;
|
||||
@@ -422,6 +425,10 @@ bool cTimer::Matches(time_t t, bool Directly, int Margin) const
|
||||
day = 0;
|
||||
}
|
||||
|
||||
if (t < deferred)
|
||||
return false;
|
||||
deferred = 0;
|
||||
|
||||
if (HasFlags(tfActive)) {
|
||||
if (HasFlags(tfVps) && event && event->Vps()) {
|
||||
if (Margin || !Directly) {
|
||||
@@ -589,6 +596,12 @@ void cTimer::SetPriority(int Priority)
|
||||
priority = Priority;
|
||||
}
|
||||
|
||||
void cTimer::SetDeferred(int Seconds)
|
||||
{
|
||||
deferred = time(NULL) + Seconds;
|
||||
isyslog("timer %s deferred for %d seconds", *ToDescr(), Seconds);
|
||||
}
|
||||
|
||||
void cTimer::SetFlags(uint Flags)
|
||||
{
|
||||
flags |= Flags;
|
||||
|
||||
Reference in New Issue
Block a user