]> git.neil.brown.name Git - history.git/commit
[PATCH] gettimeofday resolution fix
authorAndrew Morton <akpm@osdl.org>
Tue, 18 Nov 2003 16:14:43 +0000 (08:14 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 18 Nov 2003 16:14:43 +0000 (08:14 -0800)
commit5c38b5da60b6f144ede479fcfb90cd9303103868
treea18ce3f5bd4b73f2f54d6805d9b1f9294300aacc
parentd4680c6fba476f221cb3ea81075d981fabe6a3d2
[PATCH] gettimeofday resolution fix

From: Stephen Hemminger <shemminger@osdl.org>

The original problem all this is solving is that when NTP is slowing the clock
there existed real cases where time appeared to go backwards. Assuming NTP was
slowing the clock, then it would update the xtime by 999us at the next timer interrupt.
If a program read time three times:

A:     xtime = t0
B: A+1000   xtime = t0 + 1000
C: B+1     xtime = t0 + 999

To behave correctly C > B > A; but we were returning C < B

The code does have bug if we are losing clock interrupts.  The test for
lost interrupts needs to be after the interval clamp.
arch/i386/kernel/time.c