From d58679f42ddec6becae1c21b51e3b6f2a21a8075 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 8 Dec 2014 11:58:31 +0100 Subject: [PATCH] CEitManager: use unified binary search for ntp --- src/eitd/sectionsd.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 7af727702..dedd55092 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -100,7 +100,7 @@ static bool messaging_zap_detected = false; //NTP-Config #define CONF_FILE CONFIGDIR "/neutrino.conf" -std::string ntp_system_cmd_prefix = "/sbin/ntpdate "; +std::string ntp_system_cmd_prefix = find_executable("ntpdate") + " "; std::string ntp_system_cmd; std::string ntpserver; @@ -2147,8 +2147,16 @@ bool CEitManager::Start() max_events = config.epg_max_events; epg_save_frequently = config.epg_save_frequently; - if (find_executable("ntpdate").empty()) - ntp_system_cmd_prefix = "ntpd -n -q -p "; + if (find_executable("ntpdate").empty()){ + ntp_system_cmd_prefix = find_executable("ntpd"); + if (!ntp_system_cmd_prefix.empty()){ + ntp_system_cmd_prefix += " -n -q -p "; + } + else{ + printf("[sectionsd] NTP Error: time sync not possible, ntpdate/ntpd not found\n"); + ntpenable = false; + } + } printf("[sectionsd] Caching: %d days, %d hours Extended Text, max %d events, Events are old %d hours after end time\n", config.epg_cache, config.epg_extendedcache, config.epg_max_events, config.epg_old_events);