diff --git a/libav/utils.c b/libav/utils.c index 1de22c05f1..a314ec4e27 100644 --- a/libav/utils.c +++ b/libav/utils.c @@ -880,55 +880,45 @@ INT64 parse_date(const char *datestr, int duration) { const char *p; INT64 t; - int sec; + struct tm dt; + + memset(&dt, 0, sizeof(dt)); p = datestr; if (!duration) { - static const UINT8 months[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - int year, month, day, i; - if (strlen(p) >= 5 && p[4] == '-') { - - year = strtol(p, (char **)&p, 10); + dt.tm_year = strtol(p, (char **)&p, 10); if (*p) p++; - month = strtol(p, (char **)&p, 10) - 1; + dt.tm_mon = strtol(p, (char **)&p, 10) - 1; if (*p) p++; - day = strtol(p, (char **)&p, 10) - 1; + dt.tm_mday = strtol(p, (char **)&p, 10) - 1; if (*p) p++; - day += (year - 1970) * 365; - /* if >= March, take February of current year into account too */ - if (month >= 2) - year++; - for(i=1970;i