]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Erronous use of tick_usec in do_gettimeofday
authorAndrew Morton <akpm@osdl.org>
Mon, 29 Dec 2003 13:51:51 +0000 (05:51 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Mon, 29 Dec 2003 13:51:51 +0000 (05:51 -0800)
From: Joe Korty <joe.korty@ccur.com>

do_gettimeofday() is using tick_usec which is defined in terms of USER_HZ
not HZ.

arch/i386/kernel/time.c

index 1351b4c431d60a556e4534e5c3354f547c1ee215..65054ace15095fde96cb540456881a8465c9760e 100644 (file)
@@ -95,7 +95,7 @@ void do_gettimeofday(struct timeval *tv)
 {
        unsigned long seq;
        unsigned long usec, sec;
-       unsigned long max_ntp_tick = tick_usec - tickadj;
+       unsigned long max_ntp_tick;
 
        do {
                unsigned long lost;
@@ -111,13 +111,14 @@ void do_gettimeofday(struct timeval *tv)
                 * Better to lose some accuracy than have time go backwards..
                 */
                if (unlikely(time_adjust < 0)) {
+                       max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj;
                        usec = min(usec, max_ntp_tick);
 
                        if (lost)
                                usec += lost * max_ntp_tick;
                }
                else if (unlikely(lost))
-                       usec += lost * tick_usec;
+                       usec += lost * (USEC_PER_SEC / HZ);
 
                sec = xtime.tv_sec;
                usec += (xtime.tv_nsec / 1000);