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.
cheers, Joe