[2/3] avformat: Interpret times in ff_iso8601_to_unix_time as UTC

Message ID 1320704369-97079-2-git-send-email-martin@martin.st
State Committed
Commit 4a835416508820de383cda8cc906b6f1bd938889
Headers show

Commit Message

Martin Storsjö Nov. 7, 2011, 10:19 p.m.
This function is used in muxers for parsing the 'creation_time'
metadata key, for converting it to a time value.

This makes it match the behaviour of the exported 'creation_time'
metadata from demuxers, where it is in UTC, too.
---
 libavformat/utils.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Anton Khirnov Nov. 16, 2011, 9:05 a.m. | #1
On Tue,  8 Nov 2011 00:19:28 +0200, Martin Storsjö <martin@martin.st> wrote:
> This function is used in muxers for parsing the 'creation_time'
> metadata key, for converting it to a time value.
> 
> This makes it match the behaviour of the exported 'creation_time'
> metadata from demuxers, where it is in UTC, too.
> ---

Ok.

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index cb472c9..0acbc59 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -32,6 +32,7 @@ 
 #include "id3v2.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mathematics.h"
+#include "libavutil/parseutils.h"
 #include "riff.h"
 #include "audiointerleave.h"
 #include "url.h"
@@ -3942,7 +3943,7 @@  int64_t ff_iso8601_to_unix_time(const char *datestr)
 #if HAVE_STRPTIME
     struct tm time = {0};
     strptime(datestr, "%Y - %m - %dT%T", &time);
-    return mktime(&time);
+    return av_timegm(&time);
 #else
     av_log(NULL, AV_LOG_WARNING, "strptime() unavailable on this system, cannot convert "
                                  "the date string.\n");