From 52048c0c1fc6b27ed714e16aa7f8595cd74abb39 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Tue, 12 Oct 2021 21:39:21 +0200 Subject: [PATCH] xmlutil: try to fix xmltv for hd2 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/196f989bd105808e328091f071a5ed4f909e6464 Author: TangoCash Date: 2021-10-12 (Tue, 12 Oct 2021) Origin message was: ------------------ - xmlutil: try to fix xmltv for hd2 --- src/eitd/xmlutil.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index f10ca520a..fa2c90c98 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -474,8 +474,24 @@ bool readEventsFromXMLTV(std::string &epgname, int &ev_count) const char *stop = xmlGetAttribute(programme, "stop"); struct tm starttime, stoptime; +#ifdef BOXMODEL_CST_HD2 + char sign; + int offset_h; + int offset_m; + sscanf(start, "%04d%02d%02d%02d%02d%02d %c%02d%02d", &(starttime.tm_year), &(starttime.tm_mon), &(starttime.tm_mday), &(starttime.tm_hour), &(starttime.tm_min), &(starttime.tm_sec), &sign, &offset_h, &offset_m); + starttime.tm_year -= 1900; + starttime.tm_mon -= 1; + starttime.tm_isdst = -1; + starttime.tm_gmtoff = (sign == '-' ? -1 : 1) * (offset_h*60*60 + offset_m*60); + sscanf(stop, "%04d%02d%02d%02d%02d%02d %c%02d%02d", &(stoptime.tm_year), &(stoptime.tm_mon), &(stoptime.tm_mday), &(stoptime.tm_hour), &(stoptime.tm_min), &(stoptime.tm_sec), &sign, &offset_h, &offset_m); + stoptime.tm_year -= 1900; + stoptime.tm_mon -= 1; + stoptime.tm_isdst = -1; + stoptime.tm_gmtoff = (sign == '-' ? -1 : 1) * (offset_h*60*60 + offset_m*60); +#else strptime(start, "%Y%m%d%H%M%S %z", &starttime); strptime(stop, "%Y%m%d%H%M%S %z", &stoptime); +#endif time_t start_time = mktime(&starttime) + starttime.tm_gmtoff; time_t duration = mktime(&stoptime) + stoptime.tm_gmtoff - start_time;