mirror of https://git.ffmpeg.org/ffmpeg.git
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>
This commit is contained in:
commit
4a39d4c65a
|
@ -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);
|
||||
|
|
|
@ -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(×tamp);
|
||||
struct tm tmbuf;
|
||||
struct tm *time = gmtime_r(×tamp, &tmbuf);
|
||||
if (!time)
|
||||
return 0;
|
||||
return (uint64_t)(time->tm_year+1900) << 48 |
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue