summaryrefslogtreecommitdiff
path: root/libavformat/flvdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-05-10 09:15:29 +0200
committerAnton Khirnov <anton@khirnov.net>2021-05-12 20:19:02 +0200
commit6a9a4f34bd4ab10726d43f8961edfd99a5c47647 (patch)
tree295fe8a5f14059acf02e1e648dec8e592a8eb0d7 /libavformat/flvdec.c
parentdcb285d2b7d126c80fad6079400a904e813442c1 (diff)
lavf/flvdec: normalize exporting date metadata
Export them in UTC, not the local timezone. This way the output is the same everywhere. The timezone information stored in the file is still ignored, since there seems to be no simple way to export it correctly. Format them according to ISO 8601, which we generally use for exporting dates. Fixes fate-flv-demux, which was broken since 958bea5248f87116b0dd080461aa70c14ea86cf0 on some platforms.
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r--libavformat/flvdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index e6c2877a74..ddaceaafe4 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -686,8 +686,11 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
struct tm t;
char datestr[128];
time = date.milliseconds / 1000; // to seconds
- localtime_r(&time, &t);
- strftime(datestr, sizeof(datestr), "%a, %d %b %Y %H:%M:%S %z", &t);
+ gmtime_r(&time, &t);
+
+ // timezone is ignored, since there is no easy way to offset the UTC
+ // timestamp into the specified timezone
+ strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%SZ", &t);
av_dict_set(&s->metadata, key, datestr, 0);
}