aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/timex.h
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2008-05-01 07:34:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-01 11:03:58 -0400
commit074b3b87941c99bc0ce35385b5817924b1ed0c23 (patch)
treeaa2d11a2df37d631236a28713873023632f74a91 /include/linux/timex.h
parenteea83d896e318bda54be2d2770d2c5d6668d11db (diff)
ntp: increase time_freq resolution
This changes time_freq to a 64bit value and makes it static (the only outside user had no real need to modify it). Intermediate values were already 64bit, so the change isn't that big, but it saves a little in shifts by replacing SHIFT_NSEC with TICK_LENGTH_SHIFT. PPM_SCALE is then used to convert between user space and kernel space representation. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Cc: john stultz <johnstul@us.ibm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/timex.h')
-rw-r--r--include/linux/timex.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 3c49d173bf39..48c3376dce71 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -86,11 +86,14 @@
86 */ 86 */
87#define SHIFT_UPDATE (SHIFT_HZ + 1) /* time offset scale (shift) */ 87#define SHIFT_UPDATE (SHIFT_HZ + 1) /* time offset scale (shift) */
88#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 88#define SHIFT_USEC 16 /* frequency offset scale (shift) */
89#define SHIFT_NSEC 12 /* kernel frequency offset scale */ 89#define PPM_SCALE (NSEC_PER_USEC << (TICK_LENGTH_SHIFT - SHIFT_USEC))
90#define PPM_SCALE_INV_SHIFT 20
91#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + TICK_LENGTH_SHIFT)) / \
92 PPM_SCALE + 1)
90 93
91#define MAXPHASE 512000L /* max phase error (us) */ 94#define MAXPHASE 512000L /* max phase error (us) */
92#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ 95#define MAXFREQ 500000 /* max frequency error (ns/s) */
93#define MAXFREQ_NSEC (512000L << SHIFT_NSEC) /* max frequency error (ppb) */ 96#define MAXFREQ_SCALED ((s64)MAXFREQ << TICK_LENGTH_SHIFT)
94#define MINSEC 256 /* min interval between updates (s) */ 97#define MINSEC 256 /* min interval between updates (s) */
95#define MAXSEC 2048 /* max interval between updates (s) */ 98#define MAXSEC 2048 /* max interval between updates (s) */
96#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ 99#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */
@@ -209,8 +212,6 @@ extern int time_status; /* clock synchronization status bits */
209extern long time_maxerror; /* maximum error */ 212extern long time_maxerror; /* maximum error */
210extern long time_esterror; /* estimated error */ 213extern long time_esterror; /* estimated error */
211 214
212extern long time_freq; /* frequency offset (scaled ppm) */
213
214extern long time_adjust; /* The amount of adjtime left */ 215extern long time_adjust; /* The amount of adjtime left */
215 216
216extern void ntp_clear(void); 217extern void ntp_clear(void);