Added cTimer::VpsTime()

This commit is contained in:
Klaus Schmidinger
2025-07-10 19:12:24 +02:00
parent 9a8639bd61
commit 0c654ed2a7
4 changed files with 18 additions and 5 deletions

View File

@@ -2604,6 +2604,7 @@ Markus Ehrnsperger <markus.ehrnsperger@googlemail.com>
for reporting that cTimer::StartTime() may return different values, depending on the
parameters of a previous call to cTimer::Matches()
for fixing the stop time of repeating timers in case of DST change
for suggesting to add cTimer::VpsTime()
Werner Färber <w.faerber@gmx.de>
for reporting a bug in handling the cPluginManager::Active() result when pressing

View File

@@ -10138,7 +10138,7 @@ Video Disk Recorder Revision History
- Fixed an invalid lock sequence when pressing the Channel+/Channel- keys while in the
"What's on..." menu in live view.
2025-07-09:
2025-07-10:
- Fixed cPoller::Poll() to allow negative timeout values again.
- When regenerating the index of a recording, PID changes are now taken into account
@@ -10168,3 +10168,4 @@ Video Disk Recorder Revision History
- Fixed expiring VPS timers in case the event has not yet startet after its announced end time.
- Reverted the change in cCondWait::SleepMs() because of a possible lockup (reported by Johann
Friedrichs).
- Added cTimer::VpsTime() (suggested by Markus Ehrnsperger).

View File

@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.c 5.28 2025/07/09 14:49:59 kls Exp $
* $Id: timers.c 5.29 2025/07/10 19:12:24 kls Exp $
*/
#include "timers.h"
@@ -608,6 +608,13 @@ void cTimer::CalcStartStopTime(time_t &startTime, time_t &stopTime, time_t t) co
}
}
time_t cTimer::VpsTime(time_t t) const
{
time_t startTime, stopTime;
CalcStartStopTime(startTime, stopTime, t);
return startTime;
}
#if DEPRECATED_TIMER_MATCHES
bool cTimer::Matches(time_t t, bool Directly) const
{
@@ -797,8 +804,9 @@ bool cTimer::Expired(void) const
}
if (FirstEvent) {
if (Schedule) {
time_t Vps = VpsTime();
for (const cEvent *e = FirstEvent; e; e = Schedule->Events()->Next(e)) {
if (e->Vps() == StartTime()) {
if (e->Vps() == Vps) {
ExpireTime = e->EndTime() + EXPIRELATENCY;
dsyslog("timer %s is waiting for next VPS event %s", *ToDescr(), *e->ToDescr());
// no break here - let's play it safe and look at *all* events
@@ -1132,7 +1140,7 @@ bool cTimer::HasFlags(uint Flags) const
void cTimer::Skip(void)
{
cMutexLock MutexLock(&mutex);
day = IncDay(SetTime(StartTime(), 0), 1);
day = IncDay(SetTime(VpsTime(), 0), 1);
startTime = 0;
SetEvent(NULL);
}

View File

@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.h 5.13 2025/07/06 15:06:55 kls Exp $
* $Id: timers.h 5.14 2025/07/10 19:12:24 kls Exp $
*/
#ifndef __TIMERS_H
@@ -100,6 +100,9 @@ public:
///< Calculates the raw start and stop time of this timer, as given by the user in the timer definition.
///< If t is given, and this is a repeating timer, the start and stop times on that day are returned
///< (default is "today"). t can be any time_t value on the given day.
time_t VpsTime(time_t t = 0) const;
///< Returns the VPS time of this timer. This is a shortcut for calling CalcStartStopTime() and using the
///< result given in the startTime parameter. The parameter t is handed to CalcStartStopTime().
#define DEPRECATED_TIMER_MATCHES 1
#if DEPRECATED_TIMER_MATCHES
// for backwards compatibility, remove these functions once Matches(time_t ...) has default parameters: