Skip to content

Commit

Permalink
timekeeping: Fix CLOCK_MONOTONIC inconsistency during leapsecond
Browse files Browse the repository at this point in the history
Commit 6b43ae8 (ntp: Fix leap-second hrtimer livelock) broke the
leapsecond update of CLOCK_MONOTONIC. The missing leapsecond update to
wall_to_monotonic causes discontinuities in CLOCK_MONOTONIC.

Adjust wall_to_monotonic when NTP inserted a leapsecond.

Reported-by: Richard Cochran <[email protected]>
Signed-off-by: John Stultz <[email protected]>
Tested-by: Richard Cochran <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
johnstultz-work authored and KAGA-KOKO committed Jun 4, 2012
1 parent 9171c67 commit fad0c66
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
timekeeper.xtime.tv_sec++;
leap = second_overflow(timekeeper.xtime.tv_sec);
timekeeper.xtime.tv_sec += leap;
timekeeper.wall_to_monotonic.tv_sec -= leap;
}

/* Accumulate raw time */
Expand Down Expand Up @@ -1077,6 +1078,7 @@ static void update_wall_time(void)
timekeeper.xtime.tv_sec++;
leap = second_overflow(timekeeper.xtime.tv_sec);
timekeeper.xtime.tv_sec += leap;
timekeeper.wall_to_monotonic.tv_sec -= leap;
}

timekeeping_update(false);
Expand Down

0 comments on commit fad0c66

Please sign in to comment.