lkml.org 
[lkml]   [2004]   [Dec]   [3]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateFri, 3 Dec 2004 00:56:46 -0800
FromAndrew Morton <>
SubjectRe: do_posix_clock_monotonic_gettime() returns negative nsec
George Anzinger <george@mvista.com> wrote:
>
>  > George: You have any comment?
> 
>  Two, in fact.  First, the result here is the sum of wall_to_monotonic and 
>  getnstimeofday().  If nsec < 0, one or more of these must be also.  Both of 
>  these values are SUPPOSED to be normalized.

As Herbert points out, hpet_time_init() and time_init() and who knows what
else do:

	wall_to_monotonic.tv_sec = -xtime.tv_sec;
	xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
	wall_to_monotonic.tv_nsec = -xtime.tv_nsec;

And this:

 * The current time 
 * wall_to_monotonic is what we need to add to xtime (or xtime corrected 
 * for sub jiffie times) to get to monotonic time.  Monotonic is pegged at zero
 * at zero at system boot time, so wall_to_monotonic will be negative,
 * however, we will ALWAYS keep the tv_nsec part positive so we can use
 * the usual normalization.

So I assume the bug is that time_init() is failing to normalise
wall_to_monotonic?
-
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/

\
 
 \ /
  Last update: 2005-03-22 14:08    [from the cache]
©2003-2008