diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2008-05-01 07:34:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-01 11:03:58 -0400 |
commit | 9f14f669d18477fe3df071e2fa4da36c00acee8e (patch) | |
tree | 84b5600017902ced77ee0cb9a4bc21a6768d22e5 /include | |
parent | 074b3b87941c99bc0ce35385b5817924b1ed0c23 (diff) |
ntp: increase time_offset resolution
time_offset is already a 64bit value but its resolution barely used, so this
makes better use of it by replacing SHIFT_UPDATE with TICK_LENGTH_SHIFT.
Side note: the SHIFT_HZ in SHIFT_UPDATE was incorrect for CONFIG_NO_HZ and the
primary reason for changing time_offset to 64bit to avoid the overflow.
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')
-rw-r--r-- | include/linux/timex.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/include/linux/timex.h b/include/linux/timex.h index 48c3376dce71..9fbdd12a52f1 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -76,27 +76,22 @@ | |||
76 | #define MAXTC 10 /* maximum time constant (shift) */ | 76 | #define MAXTC 10 /* maximum time constant (shift) */ |
77 | 77 | ||
78 | /* | 78 | /* |
79 | * The SHIFT_UPDATE define establishes the decimal point of the | ||
80 | * time_offset variable which represents the current offset with | ||
81 | * respect to standard time. | ||
82 | * | ||
83 | * SHIFT_USEC defines the scaling (shift) of the time_freq and | 79 | * SHIFT_USEC defines the scaling (shift) of the time_freq and |
84 | * time_tolerance variables, which represent the current frequency | 80 | * time_tolerance variables, which represent the current frequency |
85 | * offset and maximum frequency tolerance. | 81 | * offset and maximum frequency tolerance. |
86 | */ | 82 | */ |
87 | #define SHIFT_UPDATE (SHIFT_HZ + 1) /* time offset scale (shift) */ | ||
88 | #define SHIFT_USEC 16 /* frequency offset scale (shift) */ | 83 | #define SHIFT_USEC 16 /* frequency offset scale (shift) */ |
89 | #define PPM_SCALE (NSEC_PER_USEC << (TICK_LENGTH_SHIFT - SHIFT_USEC)) | 84 | #define PPM_SCALE (NSEC_PER_USEC << (TICK_LENGTH_SHIFT - SHIFT_USEC)) |
90 | #define PPM_SCALE_INV_SHIFT 20 | 85 | #define PPM_SCALE_INV_SHIFT 20 |
91 | #define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + TICK_LENGTH_SHIFT)) / \ | 86 | #define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + TICK_LENGTH_SHIFT)) / \ |
92 | PPM_SCALE + 1) | 87 | PPM_SCALE + 1) |
93 | 88 | ||
94 | #define MAXPHASE 512000L /* max phase error (us) */ | 89 | #define MAXPHASE 500000000l /* max phase error (ns) */ |
95 | #define MAXFREQ 500000 /* max frequency error (ns/s) */ | 90 | #define MAXFREQ 500000 /* max frequency error (ns/s) */ |
96 | #define MAXFREQ_SCALED ((s64)MAXFREQ << TICK_LENGTH_SHIFT) | 91 | #define MAXFREQ_SCALED ((s64)MAXFREQ << TICK_LENGTH_SHIFT) |
97 | #define MINSEC 256 /* min interval between updates (s) */ | 92 | #define MINSEC 256 /* min interval between updates (s) */ |
98 | #define MAXSEC 2048 /* max interval between updates (s) */ | 93 | #define MAXSEC 2048 /* max interval between updates (s) */ |
99 | #define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ | 94 | #define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */ |
100 | 95 | ||
101 | /* | 96 | /* |
102 | * syscall interface - used (mainly by NTP daemon) | 97 | * syscall interface - used (mainly by NTP daemon) |