- sectionsd: move function build_time() to helpers

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2022-01-11 23:39:59 +01:00
committed by Thilo Graf
parent 9f0b46d11c
commit 9ed525d199
3 changed files with 11 additions and 10 deletions

View File

@@ -159,15 +159,6 @@ CSdtThread threadSDT;
static int64_t lockstart = 0; static int64_t lockstart = 0;
#endif #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 int sectionsd_stop = 0;
static bool slow_addevent = true; static bool slow_addevent = true;
@@ -1580,7 +1571,7 @@ void CTimeThread::run()
sleep_time = 5; sleep_time = 5;
} }
/* in case of wrong TDT date, dont send time is set */ /* in case of wrong TDT date, dont send time is set */
if(time_ntp || (dvb_time > build_time())) { if(time_ntp || (dvb_time > GetBuildTime())) {
sendTimeEvent(time_ntp, dvb_time); sendTimeEvent(time_ntp, dvb_time);
debug(DEBUG_ERROR, "%s: Time set via %s, going to sleep for %d seconds.", name.c_str(), 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); time_ntp ? "NTP" : first_time ? "DVB (TDT)" : "DVB (TOT)", sleep_time);

View File

@@ -1874,6 +1874,15 @@ bool isDigitWord(std::string str)
return true; return true;
} }
time_t GetBuildTime()
{
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);
}
int getBoxMode() int getBoxMode()
{ {
int boxmode = -1; int boxmode = -1;

View File

@@ -192,6 +192,7 @@ bool downloadUrl(std::string url, std::string file, const std::string userAgent
bool isDigitWord(std::string str); bool isDigitWord(std::string str);
time_t GetBuildTime();
int getBoxMode(); int getBoxMode();
int getActivePartition(); int getActivePartition();