diff options
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 524c7f638365..623f9ea198d8 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -780,16 +780,29 @@ static void update_wall_time_one_tick(void) | |||
780 | * Return how long ticks are at the moment, that is, how much time | 780 | * Return how long ticks are at the moment, that is, how much time |
781 | * update_wall_time_one_tick will add to xtime next time we call it | 781 | * update_wall_time_one_tick will add to xtime next time we call it |
782 | * (assuming no calls to do_adjtimex in the meantime). | 782 | * (assuming no calls to do_adjtimex in the meantime). |
783 | * The return value is in fixed-point nanoseconds with SHIFT_SCALE-10 | 783 | * The return value is in fixed-point nanoseconds shifted by the |
784 | * bits to the right of the binary point. | 784 | * specified number of bits to the right of the binary point. |
785 | * This function has no side-effects. | 785 | * This function has no side-effects. |
786 | */ | 786 | */ |
787 | u64 current_tick_length(void) | 787 | u64 current_tick_length(long shift) |
788 | { | 788 | { |
789 | long delta_nsec; | 789 | long delta_nsec; |
790 | u64 ret; | ||
790 | 791 | ||
792 | /* calculate the finest interval NTP will allow. | ||
793 | * ie: nanosecond value shifted by (SHIFT_SCALE - 10) | ||
794 | */ | ||
791 | delta_nsec = tick_nsec + adjtime_adjustment() * 1000; | 795 | delta_nsec = tick_nsec + adjtime_adjustment() * 1000; |
792 | return ((u64) delta_nsec << (SHIFT_SCALE - 10)) + time_adj; | 796 | ret = ((u64) delta_nsec << (SHIFT_SCALE - 10)) + time_adj; |
797 | |||
798 | /* convert from (SHIFT_SCALE - 10) to specified shift scale: */ | ||
799 | shift = shift - (SHIFT_SCALE - 10); | ||
800 | if (shift < 0) | ||
801 | ret >>= -shift; | ||
802 | else | ||
803 | ret <<= shift; | ||
804 | |||
805 | return ret; | ||
793 | } | 806 | } |
794 | 807 | ||
795 | /* XXX - all of this timekeeping code should be later moved to time.c */ | 808 | /* XXX - all of this timekeeping code should be later moved to time.c */ |