From 82ee7d0dda0fec8cdb670f4e844bf5c2927ad9de Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Fri, 24 Oct 2014 10:46:36 +0300 Subject: Use gmtime_r instead of gmtime and localtime_r instead of localtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gmtime isn't thread safe in general. In msvcrt (which lacks gmtime_r), the buffer used by gmtime is thread specific though. One call to localtime is left in avconv_opt.c, where thread safety shouldn't matter (instead of making avconv depend on the libavutil internal header). Signed-off-by: Martin Storsjö --- libavformat/mxfenc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libavformat/mxfenc.c') diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index ea7a4bbf93..2cf77df69a 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -35,6 +35,7 @@ #include #include "libavutil/random_seed.h" +#include "libavutil/time_internal.h" #include "libavcodec/bytestream.h" #include "audiointerleave.h" #include "avformat.h" @@ -1386,7 +1387,8 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, static uint64_t mxf_parse_timestamp(time_t timestamp) { - struct tm *time = gmtime(×tamp); + struct tm tmbuf; + struct tm *time = gmtime_r(×tamp, &tmbuf); if (!time) return 0; return (uint64_t)(time->tm_year+1900) << 48 | -- cgit v1.2.3