summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-01-27 15:48:18 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-01-27 15:48:18 +0000
commit7210dcb41ac769e73ba9efc04c8803e255a768d7 (patch)
tree2cb64eec4fe5863220532cc5310d99be92f7263b /cpukit/posix
parent635652ecf69464c8743bed2ce9b7ac1b49a1d92f (diff)
downloadrtems-7210dcb41ac769e73ba9efc04c8803e255a768d7.tar.bz2
2003-01-27 Juan Zamorano <jzamora@fi.upm.es>
* src/ptimer1.c: Correct problem which could lead to overflow in time math.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/ChangeLog5
-rw-r--r--cpukit/posix/src/ptimer1.c7
2 files changed, 8 insertions, 4 deletions
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 <jzamora@fi.upm.es>
+
+ * src/ptimer1.c: Correct problem which could lead to overflow in time
+ math.
+
2003-01-03 Joel Sherrill <joel@OARcorp.com>
* 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,