From 2417d1f3902ee7bfa78ffd6aeb3ea5421a7ac2dd Mon Sep 17 00:00:00 2001 From: Jochen Dolze Date: Thu, 5 Mar 2009 22:01:56 +0100 Subject: Moved processing into a thread Small wakeup handling fixes --- infosatepg.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'infosatepg.cpp') diff --git a/infosatepg.cpp b/infosatepg.cpp index e8b1ca0..74f029b 100644 --- a/infosatepg.cpp +++ b/infosatepg.cpp @@ -127,14 +127,18 @@ void cPluginInfosatepg::MainThreadHook(void) // Perform actions in the context of the main program thread. if (!global->WaitOk()) return; - if (!global->ProcessedAll()) + if ((global->Infosatdata[pmac].ReceivedAll()) && (!global->ProcessedAll())) { - if ((!global->Infosatdata[pmac].Processed) && global->Infosatdata[pmac].ReceivedAll()) + if (!global->Infosatdata[pmac].Processed) { isyslog ("infosatepg: found data to be processed: day=%i month=%i", global->Infosatdata[pmac].Day(),global->Infosatdata[pmac].Month()); cProcessInfosatepg process(pmac,global); - if (global->Infosatdata[pmac].Processed) pmac++; + process.Start(); + } + else + { + pmac++; } global->SetWaitTimer(); } @@ -233,18 +237,11 @@ time_t cPluginInfosatepg::WakeupTime(void) if (global->WakeupTime()==-1) return 0; // just to be safe time_t Now = time(NULL); time_t Time = global->WakeupTime(); - double diff = difftime(Time,Now); - if (diff<0) + if (difftime(Time,Now)<0) { // wakeup time is in the past -> add a day Time = cTimer::IncDay(Time,1); } - else - { - // wakeup time is in less than 1 hour -> add a day - if (diff<3600) - Time = cTimer::IncDay(Time,1); - } return Time; } -- cgit v1.2.3