Commit da152b74 authored by Eric Piel's avatar Eric Piel Committed by David Mosberger

[PATCH] ia64: fix settimeofday() not synchronised with gettimeofday()

Eric Piel wrote:
> However, now, it still gives negative difference:
> # ./a.out
> requested:      1047572128s 2564ns
> new:            1047572128s 1588ns
> diff is -0.000976000sec
> 
> That's better but there is still something...
> Can anyone reproduce this bug? Any idea about what may cause this
> shifted results?
> 
> I don't understand what does the line in settimeofday():
>         nsec -= (jiffies - wall_jiffies ) * (1000000000 / HZ);

Finally I read the code to do the same thing for i386 (get and
settimeofday()). This explains the meaning of this line, in the i386
it's associated with the equivalent line in do_gettimeofday()! On ia64
everything is done inside of gettimeoffset(). Therefore I'm now
confident that suppressing this line is a Good Thing ;-) The patch doing
it wrt the bk tree is attached.

The test case confirms that it works:
requested:      1048681051s 194873ns
new:            1048681051s 194874ns
diff is  0.000001000sec

That's the same result than on a 2.4.19 . 
This also solved an error on the high resolution timers test suite.
parent b9700b82
...@@ -98,7 +98,6 @@ do_settimeofday (struct timeval *tv) ...@@ -98,7 +98,6 @@ do_settimeofday (struct timeval *tv)
* it! * it!
*/ */
nsec -= gettimeoffset(); nsec -= gettimeoffset();
nsec -= (jiffies - wall_jiffies ) * (1000000000 / HZ);
while (nsec < 0) { while (nsec < 0) {
nsec += 1000000000; nsec += 1000000000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment