From 0262cdef561fe89c5899a8b3989e6217ffedaa68 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Tue, 11 Jan 2022 14:45:40 +0100 Subject: [PATCH] - sectionsd : replace hardcoded timestamp with build timestamp --- src/eitd/sectionsd.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 7ac1aaa00..59f082718 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -159,6 +159,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; @@ -1570,8 +1579,8 @@ void CTimeThread::run() if(first_time) sleep_time = 5; } - /* in case of wrong TDT date, dont send time is set, 1609455600 - 01.01.2021 00:00:00 */ - if(time_ntp || (dvb_time > (time_t) 1609455600)) { + /* in case of wrong TDT date, dont send time is set */ + 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);