All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: Thomas Gleixner <tglx@linutronix.de>
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: Tue, 10 Jan 2006 17:37:15 -0800	[thread overview]
Message-ID: <43C4614B.40002@mvista.com> (raw)
In-Reply-To: <200601110023.35374.tglx@linutronix.de>

Thomas Gleixner wrote:
> 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};

Why yes I do.  I even found that and fixed it, but then failed to refresh the 
patch.  Thanks...

-- 
George Anzinger   george@mvista.com
HRT (High-res-timers):  http://sourceforge.net/projects/high-res-timers/

  reply	other threads:[~2006-01-11  1:37 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
2006-01-11  1:37       ` George Anzinger [this message]
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=43C4614B.40002@mvista.com \
    --to=george@mvista.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --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 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.