Fix time parsing. Fixes backlog replaying one month to many,
This commit is contained in:
parent
639e929021
commit
c0772f54bf
@ -962,11 +962,8 @@ static time_t compute_time(const char *buf)
|
|||||||
time(&tv);
|
time(&tv);
|
||||||
tm = *localtime(&tv);
|
tm = *localtime(&tv);
|
||||||
|
|
||||||
err = sscanf(buf, "%2d-%2d-%4d %2d:%2d:%2d", &tm.tm_mday, &tm.tm_mon,
|
if (strptime(buf, "%d-%m-%Y %H:%M:%S", &tm) == NULL)
|
||||||
&tm.tm_year, &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
|
|
||||||
if (err != 6)
|
|
||||||
return (time_t)-1;
|
return (time_t)-1;
|
||||||
tm.tm_year -= 1900;
|
|
||||||
return mktime(&tm);
|
return mktime(&tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user