diff options
author | phk <phk@FreeBSD.org> | 2002-03-28 16:02:44 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-03-28 16:02:44 +0000 |
commit | 8834f7590273817e6becc3660f4f8d548cea4ac0 (patch) | |
tree | d387a47dde5dc1fc6e7002c34b27b16d38144d48 /sys/kern/kern_tc.c | |
parent | 3b87cb78dbe436c7ab05f8a0a230ba666edbae00 (diff) | |
download | FreeBSD-src-8834f7590273817e6becc3660f4f8d548cea4ac0.zip FreeBSD-src-8834f7590273817e6becc3660f4f8d548cea4ac0.tar.gz |
Get the magnitude of the NTP adjustment right.
Diffstat (limited to 'sys/kern/kern_tc.c')
-rw-r--r-- | sys/kern/kern_tc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 85900bd..e058e74 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -238,10 +238,11 @@ tco_setscales(struct timecounter *tc) /* * We get nanoseconds with 32 bit binary fraction and want * 64 bit binary fraction: x = a * 2^32 / 10^9 = a * 4.294967296 - * The range is +/- 500PPM so we can multiply by about 8500 - * without overflowing. 4398/1024 = is very close to ideal. + * The range is +/- 500PPM so we can only multiply by about 8500 + * without overflowing. The best suitable fraction is 4398/1024. + * Divide by 2 times 1024 to match the temporary lower precision. */ - scale += (tc->tc_adjustment * 4398) >> 10; + scale += (tc->tc_adjustment * 4398) / 2048; scale /= tc->tc_tweak->tc_frequency; tc->tc_scale = scale * 2; } |