From 971cc458aea21832a20b1b087185659d8e9ec2b3 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 19 Feb 2019 23:00:23 +0000 Subject: fix offsets --- app/pll.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'app/pll.c') diff --git a/app/pll.c b/app/pll.c index 0c9ed80..43fb9ad 100644 --- a/app/pll.c +++ b/app/pll.c @@ -105,16 +105,26 @@ void pll_dispatch (uint64_t edge) void pll_set_offset (EPOCH epoch, uint64_t abs) { + int64_t new_offset; + int diff; + /* Find nearest second to abs*/ abs += pll_freq >> 2; abs -= phase; abs /= pll_freq; - offset = epoch.s - abs; + new_offset = epoch.s - abs; + + if (new_offset != offset) { + diff = (int) (new_offset - offset); + + + printf ("PLL wallclock offset moved by %d\r\n", diff); + offset = new_offset; + } pll_valid = 1; time_known = 1; - } -- cgit v1.2.3