Use better scaling factor for NTPs correction.
Explain the magic.
This commit is contained in:
parent
6e47a4f646
commit
4e2befc031
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91065
@ -207,7 +207,13 @@ tco_setscales(struct timecounter *tc)
|
||||
|
||||
/* Sacrifice the lower bit to the deity for code clarity */
|
||||
scale = 1ULL << 63;
|
||||
scale += (tc->tc_adjustment * 4295LL) / 1000LL;
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
scale += (tc->tc_adjustment * 4398) >> 10;
|
||||
scale /= tc->tc_tweak->tc_frequency;
|
||||
tc->tc_scale = scale * 2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user