Commit 0230f93d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] x86_64: fix do_settimeofday() for new API

parent 5aa563a9
...@@ -124,20 +124,23 @@ void do_gettimeofday(struct timeval *tv) ...@@ -124,20 +124,23 @@ void do_gettimeofday(struct timeval *tv)
* ages already. * ages already.
*/ */
void do_settimeofday(struct timeval *tv) int do_settimeofday(struct timespec *tv)
{ {
if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
return -EINVAL;
write_seqlock_irq(&xtime_lock); write_seqlock_irq(&xtime_lock);
tv->tv_usec -= do_gettimeoffset() + tv->tv_nsec -= do_gettimeoffset() * 1000 +
(jiffies - wall_jiffies) * (USEC_PER_SEC/HZ); (jiffies - wall_jiffies) * (NSEC_PER_SEC/HZ);
while (tv->tv_usec < 0) { while (tv->tv_nsec < 0) {
tv->tv_usec += 1000000; tv->tv_nsec += NSEC_PER_SEC;
tv->tv_sec--; tv->tv_sec--;
} }
xtime.tv_sec = tv->tv_sec; xtime.tv_sec = tv->tv_sec;
xtime.tv_nsec = (tv->tv_usec * 1000); xtime.tv_nsec = tv->tv_nsec;
time_adjust = 0; /* stop active adjtime() */ time_adjust = 0; /* stop active adjtime() */
time_status |= STA_UNSYNC; time_status |= STA_UNSYNC;
...@@ -146,6 +149,7 @@ void do_settimeofday(struct timeval *tv) ...@@ -146,6 +149,7 @@ void do_settimeofday(struct timeval *tv)
write_sequnlock_irq(&xtime_lock); write_sequnlock_irq(&xtime_lock);
clock_was_set(); clock_was_set();
return 0;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment