summaryrefslogtreecommitdiff
path: root/libavformat/mov.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/mov.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/mov.c')
-rw-r--r--libavformat/mov.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index a5b39f29dd..c22df1e03a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -34,6 +34,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
+#include "libavutil/time_internal.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavcodec/ac3tab.h"
@@ -739,9 +740,9 @@ static void mov_metadata_creation_time(AVDictionary **metadata, time_t time)
{
char buffer[32];
if (time) {
- struct tm *ptm;
+ struct tm *ptm, tmbuf;
time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
- ptm = gmtime(&time);
+ ptm = gmtime_r(&time, &tmbuf);
if (!ptm) return;
if (strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm))
av_dict_set(metadata, "creation_time", buffer, 0);