diff options
-rw-r--r-- | kernel/timer.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 3ba10fa35b60..6a2e5f8dc725 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -752,6 +752,15 @@ static void second_overflow(void) | |||
752 | else | 752 | else |
753 | time_adj += (time_adj >> 2) + (time_adj >> 5); | 753 | time_adj += (time_adj >> 2) + (time_adj >> 5); |
754 | #endif | 754 | #endif |
755 | #if HZ == 250 | ||
756 | /* Compensate for (HZ==250) != (1 << SHIFT_HZ). | ||
757 | * Add 1.5625% and 0.78125% to get 255.85938; => only 0.05% error (p. 14) | ||
758 | */ | ||
759 | if (time_adj < 0) | ||
760 | time_adj -= (-time_adj >> 6) + (-time_adj >> 7); | ||
761 | else | ||
762 | time_adj += (time_adj >> 6) + (time_adj >> 7); | ||
763 | #endif | ||
755 | #if HZ == 1000 | 764 | #if HZ == 1000 |
756 | /* Compensate for (HZ==1000) != (1 << SHIFT_HZ). | 765 | /* Compensate for (HZ==1000) != (1 << SHIFT_HZ). |
757 | * Add 1.5625% and 0.78125% to get 1023.4375; => only 0.05% error (p. 14) | 766 | * Add 1.5625% and 0.78125% to get 1023.4375; => only 0.05% error (p. 14) |