summaryrefslogtreecommitdiffstats
path: root/app/pll.c
diff options
context:
space:
mode:
authorroot <root@lab.panaceas.james.local>2019-02-19 23:00:23 +0000
committerroot <root@lab.panaceas.james.local>2019-02-19 23:00:23 +0000
commit971cc458aea21832a20b1b087185659d8e9ec2b3 (patch)
treef0cf4843a1b71c5860392c17ccc86a963d53b4e3 /app/pll.c
parent379b0ec3e5eacdde822966c84062bea41da7ae89 (diff)
downloadclock-971cc458aea21832a20b1b087185659d8e9ec2b3.tar.gz
clock-971cc458aea21832a20b1b087185659d8e9ec2b3.tar.bz2
clock-971cc458aea21832a20b1b087185659d8e9ec2b3.zip
fix offsets
Diffstat (limited to 'app/pll.c')
-rw-r--r--app/pll.c14
1 files changed, 12 insertions, 2 deletions
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;
-
}