summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/time/ntp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 580a35028693..fc08eb10ced4 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -142,7 +142,7 @@ static void ntp_update_offset(long offset)
* and in which mode (PLL or FLL).
*/
secs = xtime.tv_sec - time_reftime;
- if (unlikely(time_status & STA_FREQHOLD || time_reftime == 0))
+ if (unlikely(time_status & STA_FREQHOLD))
secs = 0;
time_reftime = xtime.tv_sec;
@@ -394,6 +394,13 @@ int do_adjtimex(struct timex *txc)
}
/* only set allowed bits */
time_status &= STA_RONLY;
+ /*
+ * If we turn on PLL adjustments then reset the
+ * reference time to current time.
+ */
+ if (!(time_status & STA_PLL) && (txc->status & STA_PLL))
+ time_reftime = xtime.tv_sec;
+
time_status |= txc->status & ~STA_RONLY;
switch (time_state) {