From 83be79df135e5644562963472de63b48959a938b Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Tue, 21 Aug 2012 20:04:45 +0200 Subject: [PATCH] Provide a method to report the sync interval to the clock. Signed-off-by: Richard Cochran --- clock.c | 10 ++++++++++ clock.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/clock.c b/clock.c index a3cdd71..33bcb54 100644 --- a/clock.c +++ b/clock.c @@ -601,6 +601,16 @@ enum servo_state clock_synchronize(struct clock *c, return state; } +void clock_sync_interval(struct clock *c, int n) +{ + int shift = c->dds.freq_est_interval - n; + + if (shift < 0) + shift = 0; + + c->fest.max_count = (1 << shift); +} + struct timePropertiesDS *clock_time_properties(struct clock *c) { return &c->tds; diff --git a/clock.h b/clock.h index 2566aa7..92c61d4 100644 --- a/clock.h +++ b/clock.h @@ -184,6 +184,13 @@ enum servo_state clock_synchronize(struct clock *c, Integer64 correction1, Integer64 correction2); +/** + * Inform a slaved clock about the master's sync interval. + * @param c The clock instance. + * @param n The logarithm base two of the sync interval. + */ +void clock_sync_interval(struct clock *c, int n); + /** * Obtain a clock's time properties data set. * @param c The clock instance.