summaryrefslogtreecommitdiff
path: root/libavformat/mxfenc.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2014-10-24 10:46:36 +0300
committerMartin Storsjö <martin@martin.st>2014-10-26 00:14:54 +0300
commit82ee7d0dda0fec8cdb670f4e844bf5c2927ad9de (patch)
tree5176e09d9c0cd74ddb5296be54fdb4fabca77c91 /libavformat/mxfenc.c
parent3f8f1c6ff24ee858eb5b0bf47ef6d4605299a87e (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.c4
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(&timestamp);
+ struct tm tmbuf;
+ struct tm *time = gmtime_r(&timestamp, &tmbuf);
if (!time)
return 0;
return (uint64_t)(time->tm_year+1900) << 48 |