From b94dee3e6464242db9824b261a538f37ef6a5066 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Mon, 14 Nov 2022 14:54:17 -0500 Subject: [PATCH] 2022-11-14 Fred Gleason * Fixed a race condition with calculating the effect start time of events in rdcatchd(8). Signed-off-by: Fred Gleason --- ChangeLog | 3 +++ rdcatchd/rdcatchd.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad07d75f..b9957db9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23666,3 +23666,6 @@ 2022-11-14 Fred Gleason * Fixed a regression in rdcatch(1) that caused the 'Edit Recording' dialog to load an incorrect value for the 'Source:' control. +2022-11-14 Fred Gleason + * Fixed a race condition with calculating the effect start time + of events in rdcatchd(8). diff --git a/rdcatchd/rdcatchd.cpp b/rdcatchd/rdcatchd.cpp index 1fc894a3..71898e48 100644 --- a/rdcatchd/rdcatchd.cpp +++ b/rdcatchd/rdcatchd.cpp @@ -553,10 +553,9 @@ void MainObject::engineData(int id) int event=GetEvent(id); // - // Generate Effective Date + // Generate Effective Date/Time // - QDate date=QDate::currentDate(); - QTime current_time=QTime::currentTime(); + QDateTime now=QDateTime::currentDateTime(); // // Ignore inactive or non-existent events @@ -569,7 +568,7 @@ void MainObject::engineData(int id) rda->syslog(LOG_DEBUG,"event %d is marked inactive, ignoring",id); return; } - if(!catch_events[event].dayOfWeek(date.dayOfWeek())) { + if(!catch_events[event].dayOfWeek(now.date().dayOfWeek())) { rda->syslog(LOG_DEBUG,"event %d is not valid for this DOW, ignoring",id); return; } @@ -659,7 +658,7 @@ void MainObject::engineData(int id) case RDRecording::GpiStart: catch_events[event].gpiStartTimer()-> start(catch_events[event].startLength()- - (QTime(0,0,0).msecsTo(current_time)- + (QTime(0,0,0).msecsTo(now.time())- QTime(0,0,0).msecsTo(catch_events[event].startTime()))); catch_record_deck_status[catch_events[event].channel()-1]= RDDeck::Waiting; @@ -771,8 +770,9 @@ void MainObject::engineData(int id) delete q; catch_events[event]. setResolvedUrl(RDDateTimeDecode(catch_events[event].url(), - QDateTime(date.addDays(catch_events[event].eventdateOffset()), - current_time),rda->station(),RDConfiguration())); + QDateTime(now.date(). + addDays(catch_events[event].eventdateOffset()), + now.time()),rda->station(),RDConfiguration())); StartDownloadEvent(event); break;