From: Andreas Monzner Date: Mon, 19 May 2008 15:20:29 +0000 (+0000) Subject: remove no more needed time code X-Git-Tag: 2.6.0~1232 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/17f0a48b8816b223f684b8deb227ab333e9e8725?hp=184ec9e63bb487fa942270a6153ca0789e877b22 remove no more needed time code --- diff --git a/lib/dvb/dvbtime.cpp b/lib/dvb/dvbtime.cpp index 4c18faa6..616363f9 100644 --- a/lib/dvb/dvbtime.cpp +++ b/lib/dvb/dvbtime.cpp @@ -120,7 +120,7 @@ eDVBLocalTimeHandler *eDVBLocalTimeHandler::instance; DEFINE_REF(eDVBLocalTimeHandler); eDVBLocalTimeHandler::eDVBLocalTimeHandler() - :m_time_ready(false), m_time_difference(0) + :m_time_ready(false) { if ( !instance ) instance=this; @@ -151,7 +151,7 @@ eDVBLocalTimeHandler::~eDVBLocalTimeHandler() if (ready()) { eDebug("set RTC to previous valid time"); - setRTC(nowTime()); + setRTC(::time(0)); } } @@ -192,6 +192,7 @@ void eDVBLocalTimeHandler::writeTimeOffsetData( const char* filename ) void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int update_count ) { + int time_difference; bool restart_tdt = false; if (!tp_time) restart_tdt = true; @@ -213,24 +214,22 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int up now.tm_min, now.tm_sec); time_t linuxTime=time(0); - time_t nowTime=linuxTime+m_time_difference; - localtime_r(&nowTime, &now); + localtime_r(&linuxTime, &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 %ld seconds", nowTime - rtc_time ); - if ( m_time_difference ) + time_difference = rtc_time - linuxTime; + eDebug("[eDVBLocalTimerHandler] RTC to Receiver time difference is %ld seconds", linuxTime - rtc_time ); + if ( time_difference ) { eDebug("[eDVBLocalTimerHandler] set Linux Time to RTC Time"); timeval tnow; gettimeofday(&tnow,0); tnow.tv_sec=rtc_time; settimeofday(&tnow,0); - m_time_difference=0; } - else if ( !m_time_difference ) + else if ( !time_difference ) eDebug("[eDVBLocalTimerHandler] no change needed"); else eDebug("[eDVBLocalTimerHandler] set to RTC time"); @@ -247,11 +246,8 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int up // current linux time time_t linuxTime = time(0); - // current enigma time - time_t nowTime=linuxTime+m_time_difference; - // difference between current enigma time and transponder time - int enigma_diff = tp_time-nowTime; + int enigma_diff = tp_time-linuxTime; int new_diff=0; @@ -272,7 +268,7 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int up { eDebug("[eDVBLocalTimerHandler] we have correction %d", it->second); time_t CorrectedTpTime = tp_time+it->second; - int ddiff = CorrectedTpTime-nowTime; + int ddiff = CorrectedTpTime-linuxTime; eDebug("[eDVBLocalTimerHandler] diff after add correction is %d", ddiff); if ( abs(it->second) < 300 ) // stored correction < 5 min { @@ -283,7 +279,7 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int up { time_t rtc=getRTC(); m_timeOffsetMap[chan->getChannelID()] = rtc-tp_time; - new_diff = rtc-nowTime; // set enigma time to rtc + new_diff = rtc-linuxTime; // set enigma time to rtc eDebug("[eDVBLocalTimerHandler] update stored correction to %ld (calced against RTC time)", rtc-tp_time ); } else if ( abs(ddiff) <= 120 ) @@ -319,7 +315,7 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int up m_time_ready=true; } - time_t t = nowTime+new_diff; + time_t t = linuxTime+new_diff; m_last_tp_time_difference=tp_time-t; if (!new_diff && @@ -356,17 +352,16 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int up now.tm_min, now.tm_sec); - m_time_difference = t - linuxTime; // calc our new linux_time -> enigma_time correction - eDebug("[eDVBLocalTimerHandler] m_time_difference is %d", m_time_difference ); + time_difference = t - linuxTime; // calc our new linux_time -> enigma_time correction + eDebug("[eDVBLocalTimerHandler] m_time_difference is %d", time_difference ); - if ( m_time_difference ) + if ( time_difference ) { eDebug("[eDVBLocalTimerHandler] set Linux Time"); timeval tnow; gettimeofday(&tnow,0); tnow.tv_sec=t; settimeofday(&tnow,0); - m_time_difference=0; } /*emit*/ m_timeUpdated(); diff --git a/lib/dvb/dvbtime.h b/lib/dvb/dvbtime.h index a5114f82..debbbff9 100644 --- a/lib/dvb/dvbtime.h +++ b/lib/dvb/dvbtime.h @@ -77,9 +77,7 @@ public: ~eDVBLocalTimeHandler(); #endif PSignal0 m_timeUpdated; - time_t nowTime() const { return m_time_ready ? ::time(0)+m_time_difference : -1; } bool ready() const { return m_time_ready; } - int difference() const { return m_time_difference; } static eDVBLocalTimeHandler *getInstance() { return instance; } }; diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index 1fc83f68..2a070473 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -473,7 +473,7 @@ void eEPGCache::sectionRead(const __u8 *data, int source, channel_data *channel) int duration; time_t TM = parseDVBtime( eit_event->start_time_1, eit_event->start_time_2, eit_event->start_time_3, eit_event->start_time_4, eit_event->start_time_5); - time_t now = eDVBLocalTimeHandler::getInstance()->nowTime(); + time_t now = ::time(0); if ( TM != 3599 && TM > -1) channel->haveData |= source; @@ -725,7 +725,7 @@ void eEPGCache::cleanLoop() { eDebug("[EPGC] start cleanloop"); - time_t now = eDVBLocalTimeHandler::getInstance()->nowTime(); + time_t now = ::time(0); for (eventCache::iterator DBIt = eventDB.begin(); DBIt != eventDB.end(); DBIt++) { @@ -844,7 +844,7 @@ void eEPGCache::gotMessage( const Message &msg ) onid |= 0x80000000; // we use highest bit as private epg indicator chid.original_network_id = onid; updateMap::iterator It = channelLastUpdated.find( chid ); - int update = ( It != channelLastUpdated.end() ? ( UPDATE_INTERVAL - ( (eDVBLocalTimeHandler::getInstance()->nowTime()-It->second) * 1000 ) ) : ZAP_DELAY ); + int update = ( It != channelLastUpdated.end() ? ( UPDATE_INTERVAL - ( (::time(0)-It->second) * 1000 ) ) : ZAP_DELAY ); if (update < ZAP_DELAY) update = ZAP_DELAY; data->startPrivateTimer.start(update, 1); @@ -1107,7 +1107,7 @@ bool eEPGCache::channel_data::finishEPG() { if (!isRunning) // epg ready { - eDebug("[EPGC] stop caching events(%ld)", eDVBLocalTimeHandler::getInstance()->nowTime()); + eDebug("[EPGC] stop caching events(%ld)", ::time(0)); zapTimer.start(UPDATE_INTERVAL, 1); eDebug("[EPGC] next update in %i min", UPDATE_INTERVAL / 60000); for (int i=0; i < 3; ++i) @@ -1116,7 +1116,7 @@ bool eEPGCache::channel_data::finishEPG() calcedSections[i].clear(); } singleLock l(cache->cache_lock); - cache->channelLastUpdated[channel->getChannelID()] = eDVBLocalTimeHandler::getInstance()->nowTime(); + cache->channelLastUpdated[channel->getChannelID()] = ::time(0); #ifdef ENABLE_MHW_EPG cleanup(); #endif @@ -1127,7 +1127,7 @@ bool eEPGCache::channel_data::finishEPG() void eEPGCache::channel_data::startEPG() { - eDebug("[EPGC] start caching events(%ld)", eDVBLocalTimeHandler::getInstance()->nowTime()); + eDebug("[EPGC] start caching events(%ld)", ::time(0)); state=0; haveData=0; for (int i=0; i < 3; ++i) @@ -1240,7 +1240,7 @@ void eEPGCache::channel_data::startChannel() pthread_mutex_lock(&channel_active); updateMap::iterator It = cache->channelLastUpdated.find( channel->getChannelID() ); - int update = ( It != cache->channelLastUpdated.end() ? ( UPDATE_INTERVAL - ( (eDVBLocalTimeHandler::getInstance()->nowTime()-It->second) * 1000 ) ) : ZAP_DELAY ); + int update = ( It != cache->channelLastUpdated.end() ? ( UPDATE_INTERVAL - ( (::time(0)-It->second) * 1000 ) ) : ZAP_DELAY ); if (update < ZAP_DELAY) update = ZAP_DELAY; @@ -1349,7 +1349,7 @@ void eEPGCache::channel_data::readData( const __u8 *data) break; default: eDebugNoNewLine("unknown");break; } - eDebug(" finished(%ld)", eDVBLocalTimeHandler::getInstance()->nowTime()); + eDebug(" finished(%ld)", ::time(0)); if ( reader ) reader->stop(); isRunning &= ~source; @@ -1399,7 +1399,7 @@ RESULT eEPGCache::lookupEventTime(const eServiceReference &service, time_t t, co if ( It != eventDB.end() && !It->second.first.empty() ) // entrys cached ? { if (t==-1) - t = eDVBLocalTimeHandler::getInstance()->nowTime(); + t = ::time(0); timeMap::iterator i = direction <= 0 ? It->second.second.lower_bound(t) : // find > or equal It->second.second.upper_bound(t); // just > if ( i != It->second.second.end() ) @@ -1528,7 +1528,7 @@ RESULT eEPGCache::startTimeQuery(const eServiceReference &service, time_t begin, singleLock s(cache_lock); const eServiceReferenceDVB &ref = (const eServiceReferenceDVB&)handleGroup(service); if (begin == -1) - begin = eDVBLocalTimeHandler::getInstance()->nowTime(); + begin = ::time(0); eventCache::iterator It = eventDB.find(ref); if ( It != eventDB.end() && It->second.second.size() ) { @@ -1773,7 +1773,7 @@ PyObject *eEPGCache::lookupEvent(ePyObject list, ePyObject convertFunc) } ePyObject nowTime = strchr(argstring, 'C') ? - PyLong_FromLong(eDVBLocalTimeHandler::getInstance()->nowTime()) : + PyLong_FromLong(::time(0)) : ePyObject(); int must_get_service_name = strchr(argstring, 'N') ? 1 : strchr(argstring, 'n') ? 2 : 0; @@ -1829,7 +1829,7 @@ PyObject *eEPGCache::lookupEvent(ePyObject list, ePyObject convertFunc) } if (minutes && stime == -1) - stime = eDVBLocalTimeHandler::getInstance()->nowTime(); + stime = ::time(0); eServiceReference ref(handleGroup(eServiceReference(PyString_AS_STRING(service)))); if (ref.type != eServiceReference::idDVB) @@ -2590,7 +2590,7 @@ void eEPGCache::privateSectionRead(const uniqueEPGKey ¤t_service, const __ ASSERT(ptr <= 4098); for ( std::map< date_time, std::list >::iterator it(start_times.begin()); it != start_times.end(); ++it ) { - time_t now = eDVBLocalTimeHandler::getInstance()->nowTime(); + time_t now = ::time(0); if ( (it->first.tm + duration_sec) < now ) continue; memcpy(event+2, it->first.data, 5); @@ -2666,7 +2666,7 @@ void eEPGCache::channel_data::readPrivateData( const __u8 *data) int tmp = chid.original_network_id.get(); tmp |= 0x80000000; // we use highest bit as private epg indicator chid.original_network_id = tmp; - cache->channelLastUpdated[chid] = eDVBLocalTimeHandler::getInstance()->nowTime(); + cache->channelLastUpdated[chid] = ::time(0); m_PrevVersion = (data[5] & 0x3E) >> 1; startPrivateReader(); } @@ -2725,7 +2725,7 @@ void eEPGCache::channel_data::timeMHW2DVB( u_char day, u_char hours, u_char minu // As far as we know all mhw time data is sent in central Europe time zone. // So, temporarily set timezone to western europe - time_t dt = eDVBLocalTimeHandler::getInstance()->nowTime(); + time_t dt = ::time(0); char *old_tz = getenv( "TZ" ); putenv("TZ=CET-1CEST,M3.5.0/2,M10.5.0/3"); @@ -3095,7 +3095,7 @@ void eEPGCache::channel_data::readMHWData(const __u8 *data) } } eDebug("[EPGC] mhw finished(%ld) %d summaries not found", - eDVBLocalTimeHandler::getInstance()->nowTime(), + ::time(0), m_program_ids.size()); // Summaries have been read, titles that have summaries have been stored. // Now store titles that do not have summaries. @@ -3400,7 +3400,7 @@ start_summary: for (std::map<__u32, mhw_title_t>::iterator itTitle(m_titles.begin()); itTitle != m_titles.end(); itTitle++) storeTitle( itTitle, "", data ); eDebug("[EPGC] mhw2 finished(%ld) %d summaries not found", - eDVBLocalTimeHandler::getInstance()->nowTime(), + ::time(0), m_program_ids.size()); } } diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index ddd950b4..9270a619 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -262,7 +262,7 @@ bool need_turn_fast(int turn_speed) { int begin = turn_speed >> 16; // high word is start time int end = turn_speed&0xFFFF; // low word is end time - time_t now_time = eDVBLocalTimeHandler::getInstance()->nowTime(); + time_t now_time = ::time(0); tm nowTime; localtime_r(&now_time, &nowTime); int now = (nowTime.tm_hour + 1) * 60 + nowTime.tm_min + 1; diff --git a/lib/python/Tools/Makefile.am b/lib/python/Tools/Makefile.am index 0050ee34..9d6ee5d7 100644 --- a/lib/python/Tools/Makefile.am +++ b/lib/python/Tools/Makefile.am @@ -4,4 +4,4 @@ install_PYTHON = \ FuzzyDate.py XMLTools.py Directories.py NumericalTextInput.py \ KeyBindings.py BoundFunction.py ISO639.py Notifications.py __init__.py \ RedirectOutput.py DreamboxHardware.py Import.py Event.py CList.py \ - RedirectTime.py LoadPixmap.py Profile.py + LoadPixmap.py Profile.py diff --git a/lib/python/Tools/RedirectTime.py b/lib/python/Tools/RedirectTime.py deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/python/Tools/__init__.py b/lib/python/Tools/__init__.py index 8c7bfd48..d0b6782e 100644 --- a/lib/python/Tools/__init__.py +++ b/lib/python/Tools/__init__.py @@ -1,2 +1 @@ -import RedirectTime -import RedirectOutput \ No newline at end of file +import RedirectOutput