[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.
Showing
Please register or sign in to comment