aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/timekeeping.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r--kernel/time/timekeeping.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e14c839e9faa..e960d824263f 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -690,6 +690,7 @@ static void timekeeping_adjust(s64 offset)
690static cycle_t logarithmic_accumulation(cycle_t offset, int shift) 690static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
691{ 691{
692 u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift; 692 u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift;
693 u64 raw_nsecs;
693 694
694 /* If the offset is smaller then a shifted interval, do nothing */ 695 /* If the offset is smaller then a shifted interval, do nothing */
695 if (offset < timekeeper.cycle_interval<<shift) 696 if (offset < timekeeper.cycle_interval<<shift)
@@ -706,12 +707,14 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
706 second_overflow(); 707 second_overflow();
707 } 708 }
708 709
709 /* Accumulate into raw time */ 710 /* Accumulate raw time */
710 raw_time.tv_nsec += timekeeper.raw_interval << shift;; 711 raw_nsecs = timekeeper.raw_interval << shift;
711 while (raw_time.tv_nsec >= NSEC_PER_SEC) { 712 raw_nsecs += raw_time.tv_nsec;
712 raw_time.tv_nsec -= NSEC_PER_SEC; 713 while (raw_nsecs >= NSEC_PER_SEC) {
714 raw_nsecs -= NSEC_PER_SEC;
713 raw_time.tv_sec++; 715 raw_time.tv_sec++;
714 } 716 }
717 raw_time.tv_nsec = raw_nsecs;
715 718
716 /* Accumulate error between NTP and clock interval */ 719 /* Accumulate error between NTP and clock interval */
717 timekeeper.ntp_error += tick_length << shift; 720 timekeeper.ntp_error += tick_length << shift;