aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-26 02:38:26 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-10-26 02:38:26 +0100
commit4a39d4c65a72860873daa433eab077ffcff0f913 (patch)
tree62a159e840174773f7ca5927066bd4c2c507a0de
parentedb069e55689ebff14e689254ce924a30b7bad94 (diff)
parent82ee7d0dda0fec8cdb670f4e844bf5c2927ad9de (diff)
downloadffmpeg-4a39d4c65a72860873daa433eab077ffcff0f913.tar.gz
Merge commit '82ee7d0dda0fec8cdb670f4e844bf5c2927ad9de'
* commit '82ee7d0dda0fec8cdb670f4e844bf5c2927ad9de': Use gmtime_r instead of gmtime and localtime_r instead of localtime Conflicts: libavformat/mov.c libavformat/mxfenc.c libavformat/wtvdec.c libavutil/parseutils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mov.c5
-rw-r--r--libavformat/mxfenc.c4
-rw-r--r--libavformat/wtvdec.c10
-rw-r--r--libavutil/parseutils.c5
4 files changed, 16 insertions, 8 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index bb1858886c..6ba7b96f20 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -35,6 +35,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 "libavutil/opt.h"
@@ -809,12 +810,12 @@ static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time)
{
char buffer[32];
if (time) {
- struct tm *ptm;
+ struct tm *ptm, tmbuf;
time_t timet;
if(time >= 2082844800)
time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
timet = time;
- ptm = gmtime(&timet);
+ ptm = gmtime_r(&timet, &tmbuf);
if (!ptm) return;
if (strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm))
av_dict_set(metadata, "creation_time", buffer, 0);
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index d808e4d8b3..ac05677f99 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -39,6 +39,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/timecode.h"
#include "libavutil/avassert.h"
+#include "libavutil/time_internal.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/dnxhddata.h"
#include "audiointerleave.h"
@@ -1664,7 +1665,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 |
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index de3c93158c..4009964824 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -30,6 +30,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
+#include "libavutil/time_internal.h"
#include "avformat.h"
#include "internal.h"
#include "wtv.h"
@@ -386,7 +387,8 @@ static int read_probe(AVProbeData *p)
static int filetime_to_iso8601(char *buf, int buf_size, int64_t value)
{
time_t t = (value / 10000000LL) - 11644473600LL;
- struct tm *tm = gmtime(&t);
+ struct tm tmbuf;
+ struct tm *tm = gmtime_r(&t, &tmbuf);
if (!tm)
return -1;
if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm))
@@ -401,7 +403,8 @@ static int filetime_to_iso8601(char *buf, int buf_size, int64_t value)
static int crazytime_to_iso8601(char *buf, int buf_size, int64_t value)
{
time_t t = (value / 10000000LL) - 719162LL*86400LL;
- struct tm *tm = gmtime(&t);
+ struct tm tmbuf;
+ struct tm *tm = gmtime_r(&t, &tmbuf);
if (!tm)
return -1;
if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm))
@@ -416,7 +419,8 @@ static int crazytime_to_iso8601(char *buf, int buf_size, int64_t value)
static int oledate_to_iso8601(char *buf, int buf_size, int64_t value)
{
time_t t = (av_int2double(value) - 25569.0) * 86400;
- struct tm *tm= gmtime(&t);
+ struct tm tmbuf;
+ struct tm *tm= gmtime_r(&t, &tmbuf);
if (!tm)
return -1;
if (!strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm))
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index ba4b4e1b72..4708699ccc 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -29,6 +29,7 @@
#include "eval.h"
#include "log.h"
#include "random_seed.h"
+#include "time_internal.h"
#include "parseutils.h"
#ifdef TEST
@@ -552,7 +553,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
const char *p, *q;
int64_t t;
time_t now;
- struct tm dt = { 0 };
+ struct tm dt = { 0 }, tmbuf;
int today = 0, negative = 0, microseconds = 0;
int i;
static const char * const date_fmt[] = {
@@ -647,7 +648,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
int is_utc = *q == 'Z' || *q == 'z';
q += is_utc;
if (today) { /* fill in today's date */
- struct tm dt2 = is_utc ? *gmtime(&now) : *localtime(&now);
+ struct tm dt2 = is_utc ? *gmtime_r(&now, &tmbuf) : *localtime_r(&now, &tmbuf);
dt2.tm_hour = dt.tm_hour;
dt2.tm_min = dt.tm_min;
dt2.tm_sec = dt.tm_sec;