From 7210dcb41ac769e73ba9efc04c8803e255a768d7 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 27 Jan 2003 15:48:18 +0000 Subject: 2003-01-27 Juan Zamorano * src/ptimer1.c: Correct problem which could lead to overflow in time math. --- cpukit/posix/ChangeLog | 5 +++++ cpukit/posix/src/ptimer1.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'cpukit/posix') diff --git a/cpukit/posix/ChangeLog b/cpukit/posix/ChangeLog index daeb344d9d..25c21bb555 100644 --- a/cpukit/posix/ChangeLog +++ b/cpukit/posix/ChangeLog @@ -1,3 +1,8 @@ +2003-01-27 Juan Zamorano + + * src/ptimer1.c: Correct problem which could lead to overflow in time + math. + 2003-01-03 Joel Sherrill * ChangeLog: Corrected entry for sysconf.c which did not include PR. diff --git a/cpukit/posix/src/ptimer1.c b/cpukit/posix/src/ptimer1.c index 907645ce18..ddb7d5c66a 100644 --- a/cpukit/posix/src/ptimer1.c +++ b/cpukit/posix/src/ptimer1.c @@ -175,8 +175,8 @@ void ITIMERSPEC_TO_RTEMS_TIME_OF_DAY_S rtems_time->second = seconds; - rtems_time->ticks = ( itimer->it_value.tv_nsec * SEC_TO_TICKS_C ) / - NSEC_PER_SEC_C; + rtems_time->ticks = itimer->it_value.tv_nsec/ + (NSEC_PER_SEC_C / SEC_TO_TICKS_C); } @@ -573,8 +573,7 @@ int timer_settime( timer_struct[timer_pos].ticks = ( SEC_TO_TICKS_C * value->it_value.tv_sec ) + - ( value->it_value.tv_nsec / - (1000L * (unsigned32)(1000 * 10) )); + ( value->it_value.tv_nsec / (NSEC_PER_SEC_C / SEC_TO_TICKS_C)); return_v = rtems_timer_fire_after ( timerid, timer_struct[timer_pos].ticks, -- cgit v1.2.3