diff options
author | Martin Storsjö <martin@martin.st> | 2014-10-24 10:46:36 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2014-10-26 00:14:54 +0300 |
commit | 82ee7d0dda0fec8cdb670f4e844bf5c2927ad9de (patch) | |
tree | 5176e09d9c0cd74ddb5296be54fdb4fabca77c91 /libavformat/mxfenc.c | |
parent | 3f8f1c6ff24ee858eb5b0bf47ef6d4605299a87e (diff) |
Use gmtime_r instead of gmtime and localtime_r instead of localtime
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ö <martin@martin.st>
Diffstat (limited to 'libavformat/mxfenc.c')
-rw-r--r-- | libavformat/mxfenc.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 <time.h> #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 | |