Re: gettimeofday clock jump bug

Ruth Ivimey-Cook (Ruth.Ivimey-Cook@ivimey.org)
Sat, 8 Jun 2002 00:51:59 +0100 (BST)


ashieh@OCF.Berkeley.EDU wrote:
> time() occasionally returns a
>bogus value (>1 hour jump forward, and a few microseconds later jumps back to
>the right time) on my box (Thunderbird 750, Asus K7V (KX133) kernel 2.4.17).
>This behavior sets in after the box is up for some period of time. I don't
>think this is related to the 686a configuration reset bug.
>
On Fri, 7 Jun 2002, george anzinger wrote:
>I suspect that do_gettimeoffset() may be, on occasion,
>returning a negative number. The normalizing code then
>works with this (unsigned) value until it is < 1,000,000.
>If it came back as -1, this would generate an error of about
>1.19 hours. I suspect the best fix would be to test the
>result from do_gettimeoffset() for something greater than
>say 20ms and if so set it to 0.

I've just looked at the i386 time.c source and can see no obvious way for -1
to be returned by do_gettimeoffset(). I note that this error is fixed in the
next time() call, so I would instead expect the error to be one involving the
conversion of tv_secs/tv_usecs into the seconds return from time().

One possible way to check this out would be to change the test program from
using the time() call to using gettimeofday(), and to ignore tv_usecs.

Hope this helps,

Ruth

-- 
Ruth Ivimey-Cook
Software engineer and technical writer.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/