aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/ntp.c
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2011-02-01 08:52:20 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-02 09:28:18 -0500
commit094aa1881fdc1b8889b442eb3511b31f3ec2b762 (patch)
tree2eec808286e2f57eff45178741ba3ea048de7c37 /kernel/time/ntp.c
parentc528f7c6c208f1fae6b4025957173dec045e5f21 (diff)
ntp: Add ADJ_SETOFFSET mode bit
This patch adds a new mode bit into the timex structure. When set, the bit instructs the kernel to add the given time value to the current time. Signed-off-by: Richard Cochran <richard.cochran@omicron.at> Acked-by: John Stultz <johnstul@us.ibm.com> LKML-Reference: <20110201134320.688829863@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time/ntp.c')
-rw-r--r--kernel/time/ntp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index ed8cfdf16983..5ac593267a26 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -648,6 +648,17 @@ int do_adjtimex(struct timex *txc)
648 hrtimer_cancel(&leap_timer); 648 hrtimer_cancel(&leap_timer);
649 } 649 }
650 650
651 if (txc->modes & ADJ_SETOFFSET) {
652 struct timespec delta;
653 if ((unsigned long)txc->time.tv_usec >= NSEC_PER_SEC)
654 return -EINVAL;
655 delta.tv_sec = txc->time.tv_sec;
656 delta.tv_nsec = txc->time.tv_usec;
657 if (!(txc->modes & ADJ_NANO))
658 delta.tv_nsec *= 1000;
659 timekeeping_inject_offset(&delta);
660 }
661
651 getnstimeofday(&ts); 662 getnstimeofday(&ts);
652 663
653 write_seqlock_irq(&xtime_lock); 664 write_seqlock_irq(&xtime_lock);