if ( length >= 5 )
{
time_t tptime = parseDVBtime(data[3], data[4], data[5], data[6], data[7]);
- eDVBLocalTimeHandler::getInstance()->updateTime(tptime, chan, update_count);
+ if (tptime && tptime != -1)
+ eDVBLocalTimeHandler::getInstance()->updateTime(tptime, chan, update_count);
error=0;
return 1;
}
time_t rtc_time = getRTC();
if ( rtc_time ) // RTC Ready?
{
- tm now = *localtime(&rtc_time);
+ tm now;
+ localtime_r(&rtc_time, &now);
eDebug("[eDVBLocalTimerHandler] RTC time is %02d:%02d:%02d",
now.tm_hour,
now.tm_min,
now.tm_sec);
time_t linuxTime=time(0);
time_t nowTime=linuxTime+m_time_difference;
- now = *localtime(&nowTime);
+ localtime_r(&nowTime, &now);
eDebug("[eDVBLocalTimerHandler] Receiver time is %02d:%02d:%02d",
now.tm_hour,
now.tm_min,
now.tm_sec);
m_time_difference = rtc_time - linuxTime;
- eDebug("[eDVBLocalTimerHandler] RTC to Receiver time difference is %d seconds", nowTime - rtc_time );
+ eDebug("[eDVBLocalTimerHandler] RTC to Receiver time difference is %ld seconds", nowTime - rtc_time );
if ( abs(m_time_difference) > 59 )
{
eDebug("[eDVBLocalTimerHandler] set Linux Time to RTC Time");
time_t rtc=getRTC();
m_timeOffsetMap[chan->getChannelID()] = rtc-tp_time;
new_diff = rtc-nowTime; // set enigma time to rtc
- eDebug("[eDVBLocalTimerHandler] update stored correction to %d (calced against RTC time)", rtc-tp_time );
+ eDebug("[eDVBLocalTimerHandler] update stored correction to %ld (calced against RTC time)", rtc-tp_time );
}
else if ( abs(ddiff) <= 120 )
{
return;
}
- tm now = *localtime(&t);
+ tm now;
+ localtime_r(&t, &now);
eDebug("[eDVBLocalTimerHandler] time update to %02d:%02d:%02d",
now.tm_hour,
now.tm_min,
m_knownChannels.insert( std::pair<iDVBChannel*, channel_data>(chan, channel_data()) );
tmp.first->second.tdt = NULL;
tmp.first->second.channel = chan;
+ tmp.first->second.m_prevChannelState = -1;
chan->connectStateChange(slot(*this, &eDVBLocalTimeHandler::DVBChannelStateChanged), tmp.first->second.m_stateChangedConn);
}
}
{
int state=0;
chan->getState(state);
- switch (state)
+ if ( state != it->second.m_prevChannelState )
{
- case iDVBChannel::state_ok:
- eDebug("[eDVBLocalTimerHandler] channel %p running", chan);
- it->second.tdt = new TDT(chan);
- it->second.tdt->start();
- break;
- case iDVBChannel::state_release:
- eDebug("[eDVBLocalTimerHandler] remove channel %p", chan);
- delete it->second.tdt;
- m_knownChannels.erase(it);
- break;
+ switch (state)
+ {
+ case iDVBChannel::state_ok:
+ eDebug("[eDVBLocalTimerHandler] channel %p running", chan);
+ it->second.tdt = new TDT(it->second.channel);
+ it->second.tdt->start();
+ break;
+ case iDVBChannel::state_release:
+ eDebug("[eDVBLocalTimerHandler] remove channel %p", chan);
+ delete it->second.tdt;
+ m_knownChannels.erase(it);
+ break;
+ default: // ignore all other events
+ return;
+ }
+ it->second.m_prevChannelState = state;
}
}
}