sectionsd : replace hardcoded timestamp with build timestamp

Origin commit data
------------------
Branch: ni/coolstream
Commit: 22b2436adb
Author: TangoCash <eric@loxat.de>
Date: 2022-01-11 (Tue, 11 Jan 2022)

Origin message was:
------------------
- sectionsd : replace hardcoded timestamp with build timestamp

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2022-01-11 23:39:59 +01:00
committed by vanhofen
parent e0a192406e
commit 206b3656f6

View File

@@ -162,6 +162,15 @@ CSdtThread threadSDT;
static int64_t lockstart = 0;
#endif
inline time_t build_time()
{
static const char *built = __DATE__ " " __TIME__;
struct tm t;
t.tm_isdst = -1;
strptime(built, "%b %d %Y %H:%M:%S", &t);
return mktime(&t);
}
static int sectionsd_stop = 0;
static bool slow_addevent = true;
@@ -1576,7 +1585,7 @@ void CTimeThread::run()
sleep_time = 5;
}
/* in case of wrong TDT date, dont send time is set */
if(time_ntp || (dvb_time > (time_t) BUILT_TIMESTAMP)) {
if(time_ntp || (dvb_time > build_time())) {
sendTimeEvent(time_ntp, dvb_time);
debug(DEBUG_ERROR, "%s: Time set via %s, going to sleep for %d seconds.", name.c_str(),
time_ntp ? "NTP" : first_time ? "DVB (TDT)" : "DVB (TOT)", sleep_time);