avcodec/jacosubdec: use time_internal.h, simplify code

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-11-02 20:06:08 +01:00
parent 013c3eb05c
commit bab09864b4

View File

@ -29,6 +29,7 @@
#include "jacosub.h" #include "jacosub.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/bprint.h" #include "libavutil/bprint.h"
#include "libavutil/time_internal.h"
#undef time #undef time
@ -44,11 +45,7 @@ static int insert_datetime(AVBPrint *dst, const char *in, const char *arg)
time_t now = time(0); time_t now = time(0);
struct tm ltime; struct tm ltime;
#if HAVE_LOCALTIME_R
localtime_r(&now, &ltime); localtime_r(&now, &ltime);
#else
ltime = *localtime(&now);
#endif
strftime(buf, sizeof(buf), arg, &ltime); strftime(buf, sizeof(buf), arg, &ltime);
av_bprintf(dst, "%s", buf); av_bprintf(dst, "%s", buf);
return 0; return 0;