From patchwork Tue Jul 9 08:43:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Pilar X-Patchwork-Id: 13869 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 12B7C448DFE for ; Tue, 9 Jul 2019 11:43:51 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D166E68AE86; Tue, 9 Jul 2019 11:43:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from gmmr1.centrum.cz (gmmr1.centrum.cz [46.255.225.252]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7CBBE68ADF1 for ; Tue, 9 Jul 2019 11:43:44 +0300 (EEST) Received: from gm-as1.cent (unknown [10.255.254.13]) by gmmr1.centrum.cz (Postfix) with ESMTP id 019318001C92 for ; Tue, 9 Jul 2019 10:43:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=centrum.cz; s=mail; t=1562661824; bh=NKROmIeVlqPa+6dZXk2qtp85H3VvPzwj2JzkfMNwYp0=; h=From:To:Cc:Subject:Date:From; b=jhHEdmd3u0Wm2hpBRCKzkyIzeZ6cMX4D342Cql4SZU1VqZVGSXAoEQnFWeofsniXM zEQD5mYR9OXQIBL3Pj0nh3waNTo/Q+Fl0hUpVmqqcjN5R4OGI1kGVxf+hzysuPCmYO cs7It+k6ICwYLk7M0LDkqam8M+k05iW9u24jY9aI= Received: by gm-as1.cent (Postfix, from userid 65534) id 000834800083; Tue, 9 Jul 2019 10:43:43 +0200 (CEST) X-Original-From: pilarpav@centrum.cz X-Envelope-To: ffmpeg-devel@ffmpeg.org X-Original-IP: 82.113.44.250 Received: from pavel-ubuntu.ciscorv325.com (unknown [82.113.44.250]) by gm-smtp6.centrum.cz (Postfix) with ESMTPX id A573E9C000D0; Tue, 9 Jul 2019 10:43:43 +0200 (CEST) From: Pavel Pilar To: ffmpeg-devel@ffmpeg.org Date: Tue, 9 Jul 2019 10:43:37 +0200 Message-Id: <20190709084337.314-1-pilarpav@centrum.cz> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] accurrate time output in program_date_time X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Pavel Pilar MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/hlsenc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 057134f410..00c725af18 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -23,6 +23,7 @@ #include "config.h" #include #include +#include #if HAVE_UNISTD_H #include #endif @@ -2741,9 +2742,15 @@ static int hls_init(AVFormatContext *s) } if (hls->flags & HLS_PROGRAM_DATE_TIME) { +#ifdef _POSIX_TIMERS + struct timespec now0; + clock_gettime(CLOCK_MONOTONIC, &now0); + vs->initial_prog_date_time = now0.tv_sec + now0.tv_nsec / 1e9; +#else time_t now0; time(&now0); vs->initial_prog_date_time = now0; +#endif } if (hls->format_options_str) { ret = av_dict_parse_string(&hls->format_options, hls->format_options_str, "=", ":", 0);