public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: Joe Perches <joe@perches.com>, Andrew Morton <akpm@osdl.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Timespec normalize off by one errors
Date: Fri, 11 Nov 2005 14:15:55 -0800	[thread overview]
Message-ID: <4375181B.7060104@mvista.com> (raw)
In-Reply-To: <1131744325.9957.20.camel@localhost>

Joe Perches wrote:
> On Fri, 2005-11-11 at 13:16 -0800, George Anzinger wrote:
> 
>>@@ -1209,13 +1209,9 @@ static int do_posix_clock_monotonic_get(
>> 
>> 	do_posix_clock_monotonic_gettime_parts(tp, &wall_to_mono);
>> 
>>-	tp->tv_sec += wall_to_mono.tv_sec;
>>-	tp->tv_nsec += wall_to_mono.tv_nsec;
>>+	set_normalized_timespec(tp, tp->tv_sec += wall_to_mono.tv_sec,
>>+				tv_nsec += wall_to_mono.tv_nsec);
>> 
>>-	if ((tp->tv_nsec - NSEC_PER_SEC) > 0) {
>>-		tp->tv_nsec -= NSEC_PER_SEC;
>>-		tp->tv_sec++;
>>-	}
>> 	return 0;
>> }
> 
> 
> This is extremely ugly.
> 
> tp->tv_sec += wall_to_mono.tv_sec;
> tp->tv_nsec += wall_to_mono.tv_nsec;
> set_normalized_timespec(tp, tv->sec, tv_nsec);
> 
> is much more intelligible.
> 
> Besides, I think you forgot the "tp->" indirection in the
> last argument of the set_normalized_timespec.

Oh SHIT.  That is wrong.  Think I will compile the next version...  Stand by.
> 
> cheers,  Joe
> 

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

  parent reply	other threads:[~2005-11-11 22:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-11 21:16 [PATCH] Timespec normalize off by one errors George Anzinger
     [not found] ` <1131744325.9957.20.camel@localhost>
2005-11-11 22:15   ` George Anzinger [this message]
2005-11-11 22:25 ` George Anzinger

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=4375181B.7060104@mvista.com \
    --to=george@mvista.com \
    --cc=akpm@osdl.org \
    --cc=joe@perches.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox