From cab6a1e74f2ba089d62a13fee586b7fcbf721a4a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 6 Mar 2011 15:34:16 +0000 Subject: [PATCH] sectionsd: trigger time refetch after transponder change This should ensure that the system time somehow matches the transponder time. Comments and reports welcome on the developers mailinglist. If this turns out to be not working well for all setups, it could be made configurable. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1257 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/deefb52eebd0828c51f63f41e5f69bd61ad54231 Author: Stefan Seyfried Date: 2011-03-06 (Sun, 06 Mar 2011) --- src/sectionsd/sectionsd.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/sectionsd/sectionsd.cpp b/src/sectionsd/sectionsd.cpp index 07cfd8051..5797cc3a3 100644 --- a/src/sectionsd/sectionsd.cpp +++ b/src/sectionsd/sectionsd.cpp @@ -7573,6 +7573,7 @@ static void *cnThread(void *) dmxCN.addfilter(0x4e, 0xff); //0 current TS, current/next dprintf("[%sThread] pid %d (%lu) start\n", "cn", getpid(), pthread_self()); + t_channel_id time_trigger_last = 0; int timeoutsDMX = 0; char *static_buf = new char[MAX_SECTION_LENGTH]; int rc; @@ -7737,6 +7738,22 @@ static void *cnThread(void *) messaging_eit_is_busy = false; unlockMessaging(); + /* re-fetch time if transponder changed + Why I'm doing this here and not from commandserviceChanged? + commandserviceChanged is called on zap *start*, not after zap finished + this would lead to often actually fetching the time on the transponder + you are switching away from, not the one you are switching onto. + Doing it here at least gives us a good chance to have actually tuned + to the channel we want to get the time from... + */ + if (time_trigger_last != (messaging_current_servicekey & 0xFFFFFFFF0000ULL)) + { + time_trigger_last = messaging_current_servicekey & 0xFFFFFFFF0000ULL; + pthread_mutex_lock(&timeThreadSleepMutex); + pthread_cond_broadcast(&timeThreadSleepCond); + pthread_mutex_unlock(&timeThreadSleepMutex); + } + int rs; do { pthread_mutex_lock( &dmxCN.start_stop_mutex );