mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: george@mvista.com
Cc: john stultz <johnstul@us.ibm.com>,
	Roman Zippel <zippel@linux-m68k.org>,
	linux-kernel@vger.kernel.org
Subject: Re: new time code problem
Date: Wed, 11 Jan 2006 00:23:34 +0000	[thread overview]
Message-ID: <200601110023.35374.tglx@linutronix.de> (raw)
In-Reply-To: <43C44A3C.6010803@mvista.com>

On Tuesday 10 January 2006 23:58, George Anzinger wrote:
> The 64-bit conversion routine to convert 64-bit nsec time to a time spec.
> gives an unnormalized result if the value being converted is negative.  I
> think there are two ways to go about fixing this.  Most systems will give a
> negative remainder and so need to just normalize.  On the other hand, some
> systems will use div64 to do the division and, I think, it expects unsigned
> numbers.  The attached patch uses the conservative approach of expecting
> the div to be set up for unsigned numbers.
>
> I came accross this when one of my tests set a time near 1 Jan 1970, i.e.
> it is a real problem.

> 
>  kernel/time.c |   13 ++++++++-----
>  1 files changed, 8 insertions(+), 5 deletions(-)
> 
> Index: linux-2.6.16-rc/kernel/time.c
> ===================================================================
> --- linux-2.6.16-rc.orig/kernel/time.c
> +++ linux-2.6.16-rc/kernel/time.c
> @@ -702,16 +702,19 @@ void set_normalized_timespec(struct time
>   *
>   * Returns the timespec representation of the nsec parameter.
>   */
> -inline struct timespec ns_to_timespec(const nsec_t nsec)
> +struct timespec ns_to_timespec(const nsec_t nsec)
>  {
>         struct timespec ts;
>  
> -       if (nsec)
> +       if (nsec) return (struct timespec){0, 0};

Err, you mean propably

	if(!nsec)
		return (struct timespec){0, 0};

	tglx

  

  reply	other threads:[~2006-01-11  0:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-21 23:20 [PATCH 1/10] NTP: Remove pps support Roman Zippel
2006-01-10 23:20 ` john stultz
2006-01-10 23:58   ` new time code problem George Anzinger
2006-01-11  0:23     ` Thomas Gleixner [this message]
2006-01-11  1:37       ` George Anzinger
2006-01-11  9:18   ` [PATCH 1/10] NTP: Remove pps support Ulrich Windl
2006-01-12 11:58     ` Roman Zippel

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=200601110023.35374.tglx@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=george@mvista.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®