Project "Tuxbox-GIT: apps":

The branch, master has been updated
       via  44d20e94dd472e749809105d6f0a0aa3038292e1 (commit)
      from  d936ee9b40bbca32cbf577af8b8257ae0fe7beb3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 44d20e94dd472e749809105d6f0a0aa3038292e1
Author: GetAway <get-a...@t-online.de>
Date:   Wed Jun 17 16:02:32 2015 +0200

    sectionsd: move adjtime back to rcinput
    
    cuz sometime the infobar freezed at startup,
    when there is a time jump. So it works not
    as expected and I revert it.
    
    Signed-off-by: GetAway <get-a...@t-online.de>

diff --git a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp 
b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
index 24a8cdc..30fc113 100644
--- a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
+++ b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
@@ -83,7 +83,7 @@
 #include "SIsections.hpp"
 #include "SIlanguage.hpp"
 
-#define SECTIONSD_VERSION "1.349"
+#define SECTIONSD_VERSION "1.350"
 
 // 60 Minuten Zyklus...
 #define TIME_EIT_SCHEDULED_PAUSE 60 * 60
@@ -170,7 +170,6 @@ static long secondsExtendedTextCache;
 //static long oldEventsAre = 60*60L; // 2h  (sometimes want to know something 
about current/last movie)
 static long oldEventsAre;
 static int scanning = 1;
-static long long timediff;
 
 std::string epg_filter_dir = "/var/tuxbox/config/zapit/epgfilter.xml";
 static bool epg_filter_is_whitelist = false;
@@ -6823,47 +6822,6 @@ static void parseDescriptors(const char *des, unsigned 
len, const char *countryC
 }
 
 */
-static void setSystemTime(time_t tim)
-{
-       struct timeval tv;
-       struct tm t;
-       time_t now = time(NULL);
-       struct tm *tmTime = localtime_r(&now, &t);
-
-       gettimeofday(&tv, NULL);
-       timediff = (long long)(tim * 1000000 - (tv.tv_usec + tv.tv_sec * 
1000000));
-       char tbuf[26];
-       ctime_r(&tim, tbuf);
-       xprintf("[%sThread] timediff %lld, current: %02d.%02d.%04d 
%02d:%02d:%02d, dvb: %s", "time", timediff,
-                       tmTime->tm_mday, tmTime->tm_mon+1, 
tmTime->tm_year+1900, 
-                       tmTime->tm_hour, tmTime->tm_min, tmTime->tm_sec, tbuf);
-
-
-       if (timediff == 0) /* very unlikely... :-) */
-               return;
-
-       time_t diff_time = tim - tv.tv_sec;
-       if (timeset && abs(diff_time) < 120) { /* abs() is int */
-               struct timeval oldd;
-               tv.tv_sec = time_t(timediff / 1000000LL);
-               tv.tv_usec = suseconds_t(timediff % 1000000LL);
-               if (adjtime(&tv, &oldd))
-                       xprintf("adjtime(%d, %d) failed: %m\n", (int)tv.tv_sec, 
(int)tv.tv_usec);
-               else {
-                       xprintf("difference is < 120s (%lds), using adjtime(%d, 
%d). oldd(%d, %d)\n", diff_time,
-                               (int)tv.tv_sec, (int)tv.tv_usec, 
(int)oldd.tv_sec, (int)oldd.tv_usec);
-                       timediff = 0;
-                       return;
-               }
-       }
-       
-       if (timeset)
-               xprintf("[%sThread] difference is %lds, stepping...\n", "time", 
diff_time);
-       tv.tv_sec = tim;
-       tv.tv_usec = 0;
-       if (settimeofday(&tv, NULL) < 0)
-               perror("[sectionsd] settimeofday");
-}
 
 static void setTimeSet(void)
 {
@@ -6873,13 +6831,6 @@ static void setTimeSet(void)
        pthread_mutex_unlock(&timeIsSetMutex );
 }
 
-static void sendTimeEvent(void)
-{
-       if (timediff)
-               eventServer->sendEvent(CSectionsdClient::EVT_TIMESET, 
CEventServer::INITID_SECTIONSD, &timediff, sizeof(timediff));
-       setTimeSet();
-}
-
 static void *timeThread(void *)
 {
        UTC_t UTC;
@@ -6890,6 +6841,7 @@ static void *timeThread(void *)
        struct timeval now;
        bool time_ntp = false;
        bool success = true;
+       long long timediff;
 
        try
        {
@@ -6900,18 +6852,26 @@ static void *timeThread(void *)
 
                while(1)
                {
+                       timediff = 0;
                        if (bTimeCorrect == true){              // sectionsd 
started with parameter "-tc"
                                if (first_time == true) {       // only do this 
once!
-                                       sendTimeEvent();
+                                       time_t actTime;
+                                       actTime=time(NULL);
+                                       setTimeSet();
+                                       
eventServer->sendEvent(CSectionsdClient::EVT_TIMESET, 
CEventServer::INITID_SECTIONSD, &actTime, sizeof(actTime) );
                                        printf("[timeThread] Time is already 
set by system, no further timeThread work!\n");
                                        break;
                                }
                        }
+
                        else if ( ntpenable && system( ntp_system_cmd.c_str() ) 
== 0)
                        {
+                               time_t actTime;
+                               actTime=time(NULL);
                                first_time = false;
                                time_ntp = true;
-                               sendTimeEvent();
+                               setTimeSet();
+                               
eventServer->sendEvent(CSectionsdClient::EVT_TIMESET, 
CEventServer::INITID_SECTIONSD, &actTime, sizeof(actTime) );
                        }
                        else if (scanning && dvb_time_update)
                        {
@@ -6932,9 +6892,19 @@ static void *timeThread(void *)
                                                        }
                                                }
                                        }
-                                       setSystemTime(tim);
+
+                                       struct tm tmTime;
+                                       time_t actTime = time(NULL);
+                                       localtime_r(&actTime, &tmTime);
+                                       struct timeval lt;
+                                       gettimeofday(&lt, NULL);
+                                       timediff = (long long)tim * 1000000LL - 
(lt.tv_usec + lt.tv_sec * 1000000LL);
+                                       char tbuf[26];
+                                       ctime_r(&tim, tbuf);
+                                       xprintf("[%sThread] timediff %lld, 
current: %02d.%02d.%04d %02d:%02d:%02d, dvb: %s", "time", timediff, 
tmTime.tm_mday, tmTime.tm_mon+1, tmTime.tm_year+1900, tmTime.tm_hour, 
tmTime.tm_min, tmTime.tm_sec, tbuf);
                                        time_ntp= false;
-                                       sendTimeEvent();
+                                       setTimeSet();
+                                       
eventServer->sendEvent(CSectionsdClient::EVT_TIMESET, 
CEventServer::INITID_SECTIONSD, &tim, sizeof(tim));
                                }
                        }
 
diff --git a/tuxbox/neutrino/src/driver/rcinput.cpp 
b/tuxbox/neutrino/src/driver/rcinput.cpp
index acf2bf9..540a3a3 100644
--- a/tuxbox/neutrino/src/driver/rcinput.cpp
+++ b/tuxbox/neutrino/src/driver/rcinput.cpp
@@ -1311,7 +1311,6 @@ void CRCInput::getMsg_us(neutrino_msg_t *msg, 
neutrino_msg_data_t *data, unsigne
                                                {
                                                        case 
CSectionsdClient::EVT_TIMESET:
                                                        {
-#if 0
                                                                
gettimeofday(&tv, NULL);
                                                                long long 
timeOld = tv.tv_usec + tv.tv_sec * 1000000LL;
                                                                long long 
timediff;
@@ -1337,7 +1336,7 @@ void CRCInput::getMsg_us(neutrino_msg_t *msg, 
neutrino_msg_data_t *data, unsigne
                                                                                
tv.tv_usec = timediff % 1000000LL;
                                                                                
if (adjtime(&tv, &oldd))
                                                                                
        perror("adjtime");
-                                                                               
printf("difference is %ld s (< 120s), using adjtime(%d, %d). oldd(%d, %d)\n", 
diff_time,
+                                                                               
printf("difference is < 120s (%lds), using adjtime(%d, %d). oldd(%d, %d)\n", 
diff_time,
                                                                                
        (int)tv.tv_sec, (int)tv.tv_usec, (int)oldd.tv_sec, (int)oldd.tv_usec);
                                                                        }
                                                                        else
@@ -1350,17 +1349,15 @@ void CRCInput::getMsg_us(neutrino_msg_t *msg, 
neutrino_msg_data_t *data, unsigne
                                                                delete [] p;
                                                                p = new 
unsigned char[sizeof(long long)];
                                                                *(long long*) p 
= timeNew - timeOld;
-#endif
-                                                               
printf("[neutrino] CSectionsdClient::EVT_TIMESET: timediff %lld \n", *(long 
long*) p);
-                                                               /* FIXME what 
this code really do ? */
+
                                                                if ((long 
long)last_keypress > *(long long*)p)
                                                                        
last_keypress += *(long long *)p;
 
-#if 0                                                          // Timer 
anpassen
+                                                               // Timer 
anpassen
                                                                for 
(std::vector<timer>::iterator e = timers.begin(); e != timers.end(); ++e)
                                                                        if 
(e->correct_time)
                                                                                
e->times_out += *(long long*) p;
-#endif
+
                                                                *msg  = 
NeutrinoMessages::EVT_TIMESET;
                                                                *data = 
(neutrino_msg_data_t) p;
                                                                dont_delete_p = 
true;

-----------------------------------------------------------------------

Summary of changes:
 tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp |   78 +++++++----------------
 tuxbox/neutrino/src/driver/rcinput.cpp          |   11 +--
 2 files changed, 28 insertions(+), 61 deletions(-)


-- 
Tuxbox-GIT: apps

------------------------------------------------------------------------------
_______________________________________________
Tuxbox-cvs-commits mailing list
Tuxbox-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits

Reply via email to