Neutrino sleeptimer: speed up timer deletion

Origin commit data
------------------
Branch: ni/coolstream
Commit: 0a195c7c48
Author: Christian Schuett <Gaucho316@hotmail.com>
Date: 2013-12-30 (Mon, 30 Dec 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Christian Schuett
2013-12-30 22:41:26 +01:00
committed by vanhofen
parent 08569d59a0
commit f17f57eb0e

View File

@@ -108,12 +108,15 @@ int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey)
printf("sleeptimer min: %d\n", shutdown_min); printf("sleeptimer min: %d\n", shutdown_min);
if (shutdown_min == 0) // if set to zero remove existing sleeptimer if (shutdown_min == 0) // if set to zero remove existing sleeptimer
{ {
if(g_Timerd->getSleeptimerID() > 0) { int timer_id = g_Timerd->getSleeptimerID();
g_Timerd->removeTimerEvent(g_Timerd->getSleeptimerID()); if (timer_id > 0)
} g_Timerd->removeTimerEvent(timer_id);
} }
else // set the sleeptimer to actual time + shutdown mins and announce 1 min before else // set the sleeptimer to actual time + shutdown mins and announce 1 min before
g_Timerd->setSleeptimer(time(NULL) + ((shutdown_min -1) * 60),time(NULL) + shutdown_min * 60,0); {
time_t now = time(NULL);
g_Timerd->setSleeptimer(now + (shutdown_min - 1) * 60, now + shutdown_min * 60, 0);
}
} }
is_running = false; is_running = false;