From 8f2b1db4fd3c47fd616eb16ccbb2bd884cafdc74 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 29 Apr 2018 23:37:56 -0700 Subject: [PATCH] clock: Add a method to determine whether a clock is free running. This will be needed by the end-to-end transparent clock code. Signed-off-by: Richard Cochran --- clock.c | 5 +++++ clock.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/clock.c b/clock.c index 08f0c42..30348dd 100644 --- a/clock.c +++ b/clock.c @@ -1187,6 +1187,11 @@ void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f) sizeof(c->status.lastGmPhaseChange)); } +int clock_free_running(struct clock *c) +{ + return c->free_running ? 1 : 0; +} + int clock_gm_capable(struct clock *c) { return c->grand_master_capable; diff --git a/clock.h b/clock.h index d6a79bd..efde27f 100644 --- a/clock.h +++ b/clock.h @@ -141,6 +141,13 @@ struct port *clock_first_port(struct clock *c); */ void clock_follow_up_info(struct clock *c, struct follow_up_info_tlv *f); +/** + * Determine if a clock is free running or not. + * @param c The clock instance. + * @return One if the clock is free running or zero otherwise. + */ +int clock_free_running(struct clock *c); + /** * Obtain the gmCapable flag from a clock's default data set. * This function is specific to the 802.1AS standard.