]> git.neil.brown.name Git - history.git/commitdiff
[SPARC]: Fix do_gettimeofday() as per cset 1.1347.1.17
authorDavid S. Miller <davem@nuts.ninka.net>
Wed, 22 Oct 2003 18:49:30 +0000 (11:49 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 22 Oct 2003 18:49:30 +0000 (11:49 -0700)
arch/sparc/kernel/pcic.c
arch/sparc/kernel/time.c
arch/sparc64/kernel/time.c

index 25e98c9d24793342888ba302cad6b0f5575e3c58..3bb97b4771bdc8a8753bd6be0565215b6eaf4fdd 100644 (file)
@@ -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));
index 5549a6fd172bf5071b6c3f846872303b5c0031e5..5566ad8a751ba57f574650dc9b938bf7d78caa21 100644 (file)
@@ -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));
index 4871140c13ed5ac4048ad60e248c5f0a01669e7d..d06bcc0562f132fbed930601fd5f4e2af0ba180d 100644 (file)
@@ -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));