avformat/segment: use time_internal.h, simplify code
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 2 Nov 2014 19:07:34 +0000 (20:07 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 2 Nov 2014 19:07:34 +0000 (20:07 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/segment.c

index 9db2607..4e0af7c 100644 (file)
@@ -39,6 +39,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/time.h"
+#include "libavutil/time_internal.h"
 #include "libavutil/timestamp.h"
 
 typedef struct SegmentListEntry {
@@ -716,11 +717,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
         if (seg->use_clocktime) {
             int64_t avgt = av_gettime();
             time_t sec = avgt / 1000000;
-#if HAVE_LOCALTIME_R
             localtime_r(&sec, &ti);
-#else
-            ti = *localtime(&sec);
-#endif
             usecs = (int64_t)(ti.tm_hour*3600 + ti.tm_min*60 + ti.tm_sec) * 1000000 + (avgt % 1000000);
             wrapped_val = usecs % seg->time;
             if (seg->last_cut != usecs && wrapped_val < seg->last_val) {