Commit 59488495 authored by David S. Miller's avatar David S. Miller Committed by Linus Torvalds

[SPARC]: Fix do_gettimeofday() as per cset 1.1347.1.17

parent 164cf89e
......@@ -785,6 +785,15 @@ static void pci_do_gettimeofday(struct timeval *tv)
if (lost)
usec += lost * (1000000 / HZ);
}
/*
* If time_adjust is negative then NTP is slowing the clock
* so make sure not to go into next possible interval.
* Better to lose some accuracy than have time go backwards..
*/
if (unlikely(time_adjust < 0) && usec > tickadj)
usec = tickadj;
sec = xtime.tv_sec;
usec += (xtime.tv_nsec / 1000);
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
......
......@@ -490,6 +490,15 @@ void do_gettimeofday(struct timeval *tv)
if (lost)
usec += lost * (1000000 / HZ);
}
/*
* If time_adjust is negative then NTP is slowing the clock
* so make sure not to go into next possible interval.
* Better to lose some accuracy than have time go backwards..
*/
if (unlikely(time_adjust < 0) && usec > tickadj)
usec = tickadj;
sec = xtime.tv_sec;
usec += (xtime.tv_nsec / 1000);
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
......
......@@ -1149,6 +1149,15 @@ void do_gettimeofday(struct timeval *tv)
if (lost)
usec += lost * (1000000 / HZ);
}
/*
* If time_adjust is negative then NTP is slowing the clock
* so make sure not to go into next possible interval.
* Better to lose some accuracy than have time go backwards..
*/
if (unlikely(time_adjust < 0) && usec > tickadj)
usec = tickadj;
sec = xtime.tv_sec;
usec += (xtime.tv_nsec / 1000);
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
......
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