sectionsd: fix possibly fishy localtime_r usage

Origin commit data
------------------
Branch: ni/coolstream
Commit: 364dd41655
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2016-01-10 (Sun, 10 Jan 2016)


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

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2016-01-10 14:02:03 +01:00
committed by vanhofen
parent ae02e8bbe6
commit b20a97c39b

View File

@@ -1383,16 +1383,14 @@ void CTimeThread::setSystemTime(time_t tim)
{
struct timeval tv;
struct tm t;
time_t now = time(NULL);
struct tm *tmTime = localtime_r(&now, &t);
gettimeofday(&tv, NULL);
timediff = int64_t(tim * 1000000 - (tv.tv_usec + tv.tv_sec * 1000000));
localtime_r(&tv.tv_sec, &t);
xprintf("%s: timediff %" PRId64 ", current: %02d.%02d.%04d %02d:%02d:%02d, dvb: %s", name.c_str(), timediff,
tmTime->tm_mday, tmTime->tm_mon+1, tmTime->tm_year+1900,
tmTime->tm_hour, tmTime->tm_min, tmTime->tm_sec, ctime(&tim));
xprintf("%s: timediff %" PRId64 ", current: %02d.%02d.%04d %02d:%02d:%02d, dvb: %s",
name.c_str(), timediff,
t.tm_mday, t.tm_mon+1, t.tm_year+1900, t.tm_hour, t.tm_min, t.tm_sec, ctime(&tim));
#if 0
/* if new time less than current for less than 1 second, ignore */
if(timediff < 0 && timediff > (int64_t) -1000000) {