[FFmpeg-devel] [PATCH] lavf/utils: fix ISO8601 date generation, after the switch to av_small_strptime()

Stefano Sabatini stefasab at gmail.com
Sun Sep 16 15:24:37 CEST 2012


strptime() seems to be more robust to incorrect specification containing
spaces.

Should fix trac ticket #1739.
---
 libavformat/utils.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index c6a9e58..4b6eba8 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4486,8 +4486,8 @@ int64_t ff_iso8601_to_unix_time(const char *datestr)
 {
     struct tm time1 = {0}, time2 = {0};
     char *ret1, *ret2;
-    ret1 = av_small_strptime(datestr, "%Y - %m - %d %H:%M:%S", &time1);
-    ret2 = av_small_strptime(datestr, "%Y - %m - %dT%H:%M:%S", &time2);
+    ret1 = av_small_strptime(datestr, "%Y-%m-%d %H:%M:%S", &time1);
+    ret2 = av_small_strptime(datestr, "%Y-%m-%dT%H:%M:%S", &time2);
     if (ret2 && !ret1)
         return av_timegm(&time2);
     else
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list