aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-02 19:19:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-02 19:19:07 +0100
commita52cb42ba662971cd4b65c06fec5c742368d38d8 (patch)
tree9c446c6d94e5a97e289613c222555e56e76beadc
parent70b7cf9c39d0b476f07262db0283fcd22ff9a4f0 (diff)
downloadffmpeg-a52cb42ba662971cd4b65c06fec5c742368d38d8.tar.gz
avformat/matroskadec: use gmtime_r() for thread saftey
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/matroskadec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 100e697089..f29a2904f9 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -46,6 +46,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/lzo.h"
#include "libavutil/mathematics.h"
+#include "libavutil/time_internal.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/flac.h"
@@ -1507,7 +1508,7 @@ static void matroska_metadata_creation_time(AVDictionary **metadata, int64_t dat
char buffer[32];
/* Convert to seconds and adjust by number of seconds between 2001-01-01 and Epoch */
time_t creation_time = date_utc / 1000000000 + 978307200;
- struct tm *ptm = gmtime(&creation_time);
+ struct tm tmpbuf, *ptm = gmtime_r(&creation_time, &tmpbuf);
if (!ptm) return;
if (strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm))
av_dict_set(metadata, "creation_time", buffer, 0);