instance=0;
for (std::map<iDVBChannel*, channel_data>::iterator it=m_knownChannels.begin(); it != m_knownChannels.end(); ++it)
delete it->second.tdt;
+ if (ready())
+ {
+ eDebug("set RTC to previous valid time");
+ setRTC(nowTime());
+ }
}
void eDVBLocalTimeHandler::readTimeOffsetData( const char* filename )
now.tm_sec);
m_time_difference = rtc_time - linuxTime;
eDebug("[eDVBLocalTimerHandler] RTC to Receiver time difference is %ld seconds", nowTime - rtc_time );
- if ( abs(m_time_difference) > 59 )
+ if ( m_time_difference )
{
eDebug("[eDVBLocalTimerHandler] set Linux Time to RTC Time");
timeval tnow;
gettimeofday(&tnow,0);
tnow.tv_sec=rtc_time;
settimeofday(&tnow,0);
- eMainloop::addTimeOffset(m_time_difference);
m_time_difference=0;
}
else if ( !m_time_difference )
eDebug("[eDVBLocalTimerHandler] use stored correction(<5 min)");
new_diff = ddiff;
}
- else if ( /*eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7020 && TODO !!!*/
- getRTC() )
+ else if ( getRTC() )
{
time_t rtc=getRTC();
m_timeOffsetMap[chan->getChannelID()] = rtc-tp_time;
return;
}
+ if ( !update_count )
+ {
+ // set rtc to calced transponder time when the first tdt is received on this
+ // transponder
+ setRTC(t);
+ eDebug("[eDVBLocalTimerHandler] update RTC");
+ }
+ else if (getRTC())
+ {
+ if (abs(getRTC() - t) > 60)
+ {
+ eDebug("[eDVBLocalTimerHandler] difference between new linux time and RTC time is > 60 sec... transponder time looks not ok... use rtc time");
+ t = getRTC();
+ }
+ else
+ eDebug("[eDVBLocalTimerHandler] difference between linux time and RTC time is < 60 sec... so the transponder time looks ok");
+ }
+ else
+ eDebug("[eDVBLocalTimerHandler] no RTC available :(");
+
tm now;
localtime_r(&t, &now);
eDebug("[eDVBLocalTimerHandler] time update to %02d:%02d:%02d",
m_time_difference = t - linuxTime; // calc our new linux_time -> enigma_time correction
eDebug("[eDVBLocalTimerHandler] m_time_difference is %d", m_time_difference );
-// if ( eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7020 ) TODO !!
- if ( !update_count )
- {
- // set rtc to calced transponder time when the first tdt is received on this
- // transponder
- setRTC(t);
- eDebug("[eDVBLocalTimerHandler] update RTC");
- }
- else
- eDebug("[eDVBLocalTimerHandler] don't update RTC");
-
- if ( abs(m_time_difference) > 59 )
+ if ( m_time_difference )
{
eDebug("[eDVBLocalTimerHandler] set Linux Time");
timeval tnow;
gettimeofday(&tnow,0);
tnow.tv_sec=t;
settimeofday(&tnow,0);
- eMainloop::addTimeOffset(m_time_difference);
m_time_difference=0;
}