diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-07-07 19:31:30 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-07-07 19:31:30 +0000 |
commit | df976833738becd1530739c6d695f46968008b2a (patch) | |
tree | 1ac90f042bc15ce20c438ef4f9b90d3042a184fa | |
parent | Moved __RTEMS_APPLICATION__ conditional to include the use of the (diff) | |
download | rtems-df976833738becd1530739c6d695f46968008b2a.tar.bz2 |
Fixed problem reported by Victor V. Vengerov <Victor.Vengerov@oktet.ru>
where alarm() did not correctly account for the watchdog start_time
and stop_time fields being based on ticks not seconds. This resulted
in alarm() returning a bogus number of seconds remaining.
Diffstat (limited to '')
-rw-r--r-- | c/src/exec/posix/src/alarm.c | 8 | ||||
-rw-r--r-- | cpukit/posix/src/alarm.c | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/c/src/exec/posix/src/alarm.c b/c/src/exec/posix/src/alarm.c index bef81d6695..10be929d25 100644 --- a/c/src/exec/posix/src/alarm.c +++ b/c/src/exec/posix/src/alarm.c @@ -35,8 +35,14 @@ unsigned int alarm( case WATCHDOG_ACTIVE: case WATCHDOG_REMOVE_IT: + /* + * The stop_time and start_time fields are snapshots of ticks since + * boot. Since alarm() is dealing in seconds, we must account for + * this. + */ + remaining = the_timer->initial - - (the_timer->stop_time - the_timer->start_time); + ((the_timer->stop_time - the_timer->start_time) / _TOD_Ticks_per_second); break; } diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c index bef81d6695..10be929d25 100644 --- a/cpukit/posix/src/alarm.c +++ b/cpukit/posix/src/alarm.c @@ -35,8 +35,14 @@ unsigned int alarm( case WATCHDOG_ACTIVE: case WATCHDOG_REMOVE_IT: + /* + * The stop_time and start_time fields are snapshots of ticks since + * boot. Since alarm() is dealing in seconds, we must account for + * this. + */ + remaining = the_timer->initial - - (the_timer->stop_time - the_timer->start_time); + ((the_timer->stop_time - the_timer->start_time) / _TOD_Ticks_per_second); break; } |