summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2008-09-23 01:42:44 +0400
committerThomas Gleixner <tglx@linutronix.de>2008-09-24 19:33:13 +0400
commitd40e944c25fb4642adb2a4c580a48218a9f3f824 (patch)
tree9be7107440704a84d17f9dde12991915931c5279 /include/linux
parent5cd1c9c5cf30d4b33df3d3f74d8142f278d536b7 (diff)
downloadlinux-d40e944c25fb4642adb2a4c580a48218a9f3f824.tar.xz
ntp: improve adjtimex frequency rounding
Change PPM_SCALE_INV_SHIFT so that it doesn't throw away any input bits (19 is the amount of the factor 2 in PPM_SCALE), the output frequency can then be calculated back to its input value, as the inverse divide produce a slightly larger value, which is then correctly rounded by the final shift. Reported-by: Martin Ziegler <ziegler@uni-freiburg.de> Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Cc: John Stultz <johnstul@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/timex.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/timex.h b/include/linux/timex.h
index c00bcdd3ae42..9007313b5b71 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -82,7 +82,7 @@
*/
#define SHIFT_USEC 16 /* frequency offset scale (shift) */
#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
-#define PPM_SCALE_INV_SHIFT 20
+#define PPM_SCALE_INV_SHIFT 19
#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
PPM_SCALE + 1)