All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: george@mvista.com
Cc: johnstul@us.ibm.com, herbert@13thfloor.at, linux-kernel@vger.kernel.org
Subject: Re: do_posix_clock_monotonic_gettime() returns negative nsec
Date: Fri, 3 Dec 2004 00:56:46 -0800	[thread overview]
Message-ID: <20041203005646.077e2e34.akpm@osdl.org> (raw)
In-Reply-To: <41B02749.70900@mvista.com>

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?

  reply	other threads:[~2004-12-03  8:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-03  2:03 do_posix_clock_monotonic_gettime() returns negative nsec Herbert Poetzl
2004-12-03  3:00 ` john stultz
2004-12-03  8:43   ` George Anzinger
2004-12-03  8:56     ` Andrew Morton [this message]
2004-12-03  3:08 ` Andrew Morton
2004-12-03  3:20   ` Herbert Poetzl
2004-12-03  8:53     ` George Anzinger
2004-12-03 17:22       ` Herbert Poetzl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041203005646.077e2e34.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=george@mvista.com \
    --cc=herbert@13thfloor.at \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.