mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
sectionsd: fix possibly fishy localtime_r usage
This commit is contained in:
committed by
svenhoefer
parent
b67062b62e
commit
364dd41655
@@ -1383,16 +1383,14 @@ void CTimeThread::setSystemTime(time_t tim)
|
|||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct tm t;
|
struct tm t;
|
||||||
time_t now = time(NULL);
|
|
||||||
struct tm *tmTime = localtime_r(&now, &t);
|
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
timediff = int64_t(tim * 1000000 - (tv.tv_usec + tv.tv_sec * 1000000));
|
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,
|
xprintf("%s: timediff %" PRId64 ", current: %02d.%02d.%04d %02d:%02d:%02d, dvb: %s",
|
||||||
tmTime->tm_mday, tmTime->tm_mon+1, tmTime->tm_year+1900,
|
name.c_str(), timediff,
|
||||||
tmTime->tm_hour, tmTime->tm_min, tmTime->tm_sec, ctime(&tim));
|
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 0
|
||||||
/* if new time less than current for less than 1 second, ignore */
|
/* if new time less than current for less than 1 second, ignore */
|
||||||
if(timediff < 0 && timediff > (int64_t) -1000000) {
|
if(timediff < 0 && timediff > (int64_t) -1000000) {
|
||||||
|
Reference in New Issue
Block a user