summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c/src/exec/posix/src/alarm.c8
-rw-r--r--cpukit/posix/src/alarm.c8
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;
}