Prepare for sub-nanosecond timestamps by passing clock offsets as floating point values to stats_add_value().
Signed-off-by: Michael Brown <mbr...@fensystems.co.uk> --- clock.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/clock.c b/clock.c index f1f1f39..c887a11 100644 --- a/clock.c +++ b/clock.c @@ -530,7 +530,7 @@ static int clock_management_set(struct clock *c, struct port *p, } static void clock_stats_update(struct clock_stats *s, - int64_t offset, double freq) + double offset, double freq) { struct stats_result offset_stats, freq_stats, delay_stats; @@ -600,8 +600,7 @@ static enum servo_state clock_no_adjust(struct clock *c, tmv_t ingress, freq = (1.0 - ratio) * 1e9; if (c->stats.max_count > 1) { - clock_stats_update(&c->stats, - tmv_to_nanoseconds(c->master_offset), freq); + clock_stats_update(&c->stats, tmv_dbl(c->master_offset), freq); } else { pr_info("master offset %10" PRId64 " s%d freq %+7.0f " "path delay %9" PRId64, @@ -1527,8 +1526,7 @@ void clock_path_delay(struct clock *c, tmv_t req, tmv_t rx) c->cur.meanPathDelay = tmv_to_TimeInterval(c->path_delay); if (c->stats.delay) - stats_add_value(c->stats.delay, - tmv_to_nanoseconds(c->path_delay)); + stats_add_value(c->stats.delay, tmv_dbl(c->path_delay)); } void clock_peer_delay(struct clock *c, tmv_t ppd, tmv_t req, tmv_t rx, @@ -1541,7 +1539,7 @@ void clock_peer_delay(struct clock *c, tmv_t ppd, tmv_t req, tmv_t rx, tsproc_up_ts(c->tsproc, req, rx); if (c->stats.delay) - stats_add_value(c->stats.delay, tmv_to_nanoseconds(ppd)); + stats_add_value(c->stats.delay, tmv_dbl(ppd)); } int clock_slave_only(struct clock *c) @@ -1614,8 +1612,7 @@ enum servo_state clock_synchronize(struct clock *c, tmv_t ingress, tmv_t origin) c->servo_state = state; if (c->stats.max_count > 1) { - clock_stats_update(&c->stats, - tmv_to_nanoseconds(c->master_offset), adj); + clock_stats_update(&c->stats, tmv_dbl(c->master_offset), adj); } else { pr_info("master offset %10" PRId64 " s%d freq %+7.0f " "path delay %9" PRId64, -- 2.9.5 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel