From 72ed1d73c5138ef3a91b030289a39654927ac81e Mon Sep 17 00:00:00 2001 From: Dave Craig Date: Fri, 24 May 2019 09:14:19 +0100 Subject: [PATCH 1/2] Time output was stripping zeroes after decimal point. Any time between x.0 seconds and x.1 seconds was being displayed incorrectly as the leading zero/zeroes after the decimal point weren't being output. --- pcapreport.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pcapreport.c b/pcapreport.c index 63e64bd..cd52508 100644 --- a/pcapreport.c +++ b/pcapreport.c @@ -634,7 +634,7 @@ static int digest_times(pcapreport_ctx_t * const ctx, &payload, &payload_len); if (rv) { - fprint_msg(">%d> WARNING: TS packet %d [ packet %d @ %d.%d s ] cannot be split.\n", + fprint_msg(">%d> WARNING: TS packet %d [ packet %d @ %d.%06d s ] cannot be split.\n", st->stream_no, st->ts_counter, ctx->pkt_counter, pcap_pkt_hdr->ts_sec, pcap_pkt_hdr->ts_usec); @@ -659,7 +659,7 @@ static int digest_times(pcapreport_ctx_t * const ctx, if (ctx->time_report) { - fprint_msg(">%d> Found PCR %lld at %d.%d s \n", st->stream_no, + fprint_msg(">%d> Found PCR %lld at %d.%06d s \n", st->stream_no, pcr, pcap_pkt_hdr->ts_sec, pcap_pkt_hdr->ts_usec); } @@ -714,7 +714,7 @@ static int digest_times(pcapreport_ctx_t * const ctx, if (tsect->section_no != 0) { fprint_msg(">%d> Skew discontinuity! Skew = %lld (> %lld) at" - " ts = %d network = %d (PCR %lld Time %d.%d)\n", + " ts = %d network = %d (PCR %lld Time %d.%06d)\n", st->stream_no, skew, st->skew_discontinuity_threshold, st->ts_counter, ctx->pkt_counter, @@ -762,7 +762,7 @@ static int digest_times(pcapreport_ctx_t * const ctx, double skew_rate = (rel_tim == 0) ? 0.0 : (double)skew / ((double)((double)rel_tim / (60*90000))); - fprint_msg(">%d> [ts %d net %d ] PCR %lld Time %d.%d [rel %d.%d] - skew = %lld (delta = %lld, rate = %.4g PTS/min) - jitter=%u\n", + fprint_msg(">%d> [ts %d net %d ] PCR %lld Time %d.%06d [rel %d.%06d] - skew = %lld (delta = %lld, rate = %.4g PTS/min) - jitter=%u\n", st->stream_no, st->ts_counter, ctx->pkt_counter, pcr, @@ -1803,7 +1803,7 @@ int main(int argc, char **argv) if (ctx->verbose) { - fprint_msg("pkt: Time = %d.%d orig_len = %d \n", + fprint_msg("pkt: Time = %d.%06d orig_len = %d \n", rec_hdr.ts_sec, rec_hdr.ts_usec, rec_hdr.orig_len); } From bc39c7ada657b4999c94a83aaee7df3d9650c805 Mon Sep 17 00:00:00 2001 From: Dave Craig Date: Fri, 24 May 2019 10:01:17 +0100 Subject: [PATCH 2/2] Relative time was being output as useconds, but was in 90kHz clock. Scale rel_tim to be give time in seconds. --- pcapreport.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pcapreport.c b/pcapreport.c index cd52508..d787a9b 100644 --- a/pcapreport.c +++ b/pcapreport.c @@ -761,14 +761,13 @@ static int digest_times(pcapreport_ctx_t * const ctx, int64_t rel_tim = t_pcr - tsect->time_first; // 90kHz double skew_rate = (rel_tim == 0) ? 0.0 : (double)skew / ((double)((double)rel_tim / (60*90000))); - fprint_msg(">%d> [ts %d net %d ] PCR %lld Time %d.%06d [rel %d.%06d] - skew = %lld (delta = %lld, rate = %.4g PTS/min) - jitter=%u\n", st->stream_no, st->ts_counter, ctx->pkt_counter, pcr, pcap_pkt_hdr->ts_sec, pcap_pkt_hdr->ts_usec, - (int)(rel_tim / (int64_t)1000000), - (int)rel_tim%1000000, + (int)(rel_tim / (int64_t)90000), + (int)((rel_tim * 1000000) / 90000) %1000000, skew, pcr_time_offset - st->last_time_offset, skew_rate, cur_jitter); }