Commit 4dc04b05 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

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

parent 3fa27a54
...@@ -134,8 +134,11 @@ void do_gettimeofday(struct timeval *tv) ...@@ -134,8 +134,11 @@ void do_gettimeofday(struct timeval *tv)
restore_flags(flags); restore_flags(flags);
} }
void do_settimeofday(struct timeval *tv) int do_settimeofday(struct timespec *tv)
{ {
if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
return -EINVAL;
cli(); cli();
/* This is revolting. We need to set the xtime.tv_usec /* This is revolting. We need to set the xtime.tv_usec
* correctly. However, the value in this location is * correctly. However, the value in this location is
...@@ -143,10 +146,10 @@ void do_settimeofday(struct timeval *tv) ...@@ -143,10 +146,10 @@ void do_settimeofday(struct timeval *tv)
* Discover what correction gettimeofday * Discover what correction gettimeofday
* would have done, and then undo it! * would have done, and then undo it!
*/ */
tv->tv_usec -= do_gettimeoffset(); tv->tv_nsec -= do_gettimeoffset() * 1000;
if (tv->tv_usec < 0) { if (tv->tv_nsec < 0) {
tv->tv_usec += 1000000; tv->tv_nsec += NSEC_PER_SEC;
tv->tv_sec--; tv->tv_sec--;
} }
...@@ -157,6 +160,7 @@ void do_settimeofday(struct timeval *tv) ...@@ -157,6 +160,7 @@ void do_settimeofday(struct timeval *tv)
time_maxerror = NTP_PHASE_LIMIT; time_maxerror = NTP_PHASE_LIMIT;
time_esterror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT;
sti(); sti();
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