mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-01 18:01:06 +02:00
sectionsd: improve time acquisition from DVB stream
* during startup, get time from TDT, to get *any* time information quickly
* after startup, immediately (after 5 seconds) retry with TDT
* later calls only use TOT. TOT is not broadcast on all channels, but the
channels that broadcast a TOT usually are much more "trustworthy" wrt
time setting
Comments welcome, also reports if this works worse than before
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1256 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Branch: ni/coolstream
Commit: 53744ed622
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-03-06 (Sun, 06 Mar 2011)
Origin message was:
------------------
sectionsd: improve time acquisition from DVB stream
* during startup, get time from TDT, to get *any* time information quickly
* after startup, immediately (after 5 seconds) retry with TDT
* later calls only use TOT. TOT is not broadcast on all channels, but the
channels that broadcast a TOT usually are much more "trustworthy" wrt
time setting
Comments welcome, also reports if this works worse than before
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1256 e54a6e83-5905-42d5-8d5c-058d10e6a962
------------------
This commit was generated by Migit
This commit is contained in:
@@ -6750,6 +6750,7 @@ static void *timeThread(void *)
|
|||||||
struct timespec restartWait;
|
struct timespec restartWait;
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
bool time_ntp = false;
|
bool time_ntp = false;
|
||||||
|
bool success = true;
|
||||||
|
|
||||||
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
||||||
|
|
||||||
@@ -6789,7 +6790,8 @@ static void *timeThread(void *)
|
|||||||
eventServer->sendEvent(CSectionsdClient::EVT_TIMESET, CEventServer::INITID_SECTIONSD, &actTime, sizeof(actTime) );
|
eventServer->sendEvent(CSectionsdClient::EVT_TIMESET, CEventServer::INITID_SECTIONSD, &actTime, sizeof(actTime) );
|
||||||
} else {
|
} else {
|
||||||
if (dvb_time_update) {
|
if (dvb_time_update) {
|
||||||
if (getUTC(&UTC, true)) // always use TDT, a lot of transponders don't provide a TOT
|
success = getUTC(&UTC, first_time); // for first time, get TDT, then TOT
|
||||||
|
if (success)
|
||||||
{
|
{
|
||||||
tim = changeUTCtoCtime((const unsigned char *) &UTC);
|
tim = changeUTCtoCtime((const unsigned char *) &UTC);
|
||||||
|
|
||||||
@@ -6810,7 +6812,6 @@ static void *timeThread(void *)
|
|||||||
actTime=time(NULL);
|
actTime=time(NULL);
|
||||||
tmTime = localtime(&actTime);
|
tmTime = localtime(&actTime);
|
||||||
xprintf("[%sThread] - %02d.%02d.%04d %02d:%02d:%02d, tim: %s", "time", tmTime->tm_mday, tmTime->tm_mon+1, tmTime->tm_year+1900, tmTime->tm_hour, tmTime->tm_min, tmTime->tm_sec, ctime(&tim));
|
xprintf("[%sThread] - %02d.%02d.%04d %02d:%02d:%02d, tim: %s", "time", tmTime->tm_mday, tmTime->tm_mon+1, tmTime->tm_year+1900, tmTime->tm_hour, tmTime->tm_min, tmTime->tm_sec, ctime(&tim));
|
||||||
first_time = false;
|
|
||||||
pthread_mutex_lock(&timeIsSetMutex);
|
pthread_mutex_lock(&timeIsSetMutex);
|
||||||
timeset = true;
|
timeset = true;
|
||||||
time_ntp= false;
|
time_ntp= false;
|
||||||
@@ -6822,15 +6823,19 @@ static void *timeThread(void *)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (timeset && dvb_time_update) {
|
if (timeset && dvb_time_update) {
|
||||||
first_time = false;
|
if (first_time)
|
||||||
seconds = ntprefresh * 60;
|
seconds = 5; /* retry a second time immediately */
|
||||||
|
else
|
||||||
|
seconds = ntprefresh * 60;
|
||||||
|
|
||||||
if(time_ntp){
|
if(time_ntp){
|
||||||
xprintf("[%sThread] Time set via NTP, going to sleep for %d seconds.\n", "time", seconds);
|
xprintf("[%sThread] Time set via NTP, going to sleep for %d seconds.\n", "time", seconds);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
xprintf("[%sThread] Time set via DVB, going to sleep for %d seconds.\n", "time", seconds);
|
xprintf("[%sThread] Time %sset via DVB(%s), going to sleep for %d seconds.\n",
|
||||||
|
"time", success?"":"not ", first_time?"TDT":"TOT", seconds);
|
||||||
}
|
}
|
||||||
|
first_time = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!first_time){
|
if (!first_time){
|
||||||
|
Reference in New Issue
Block a user