lkml.org 
[lkml]   [2005]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Timespec normalize off by one errors
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/
-
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-11-11 23:18    [W:0.033 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site