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>
This commit is contained in:
Richard Cochran
2011-02-01 13:52:20 +00:00
committed by Thomas Gleixner
parent c528f7c6c2
commit 094aa1881f
2 changed files with 13 additions and 1 deletions

View File

@@ -648,6 +648,17 @@ int do_adjtimex(struct timex *txc)
hrtimer_cancel(&leap_timer);
}
if (txc->modes & ADJ_SETOFFSET) {
struct timespec delta;
if ((unsigned long)txc->time.tv_usec >= NSEC_PER_SEC)
return -EINVAL;
delta.tv_sec = txc->time.tv_sec;
delta.tv_nsec = txc->time.tv_usec;
if (!(txc->modes & ADJ_NANO))
delta.tv_nsec *= 1000;
timekeeping_inject_offset(&delta);
}
getnstimeofday(&ts);
write_seqlock_irq(&xtime_lock);