summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/timergettime.c
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2008-01-18 16:31:57 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2008-01-18 16:31:57 +0000
commitc3925dbe923bf0944235bc2c4556955f35b0dc91 (patch)
treecebd73d709e9f2c152f42d14362923dded35f0ef /cpukit/posix/src/timergettime.c
parent2008-01-18 David Erickson <David.Erickson@drdc-rddc.gc.ca> (diff)
downloadrtems-c3925dbe923bf0944235bc2c4556955f35b0dc91.tar.bz2
2008-01-18 Jennifer Averett <jennifer.averett@OARcorp.com>
* posix/include/rtems/posix/timer.h, posix/src/cleanuppop.c, posix/src/cleanuppush.c, posix/src/mqueueclose.c, posix/src/timergettime.c, posix/src/timersettime.c, score/include/rtems/score/timespec.h:
Diffstat (limited to 'cpukit/posix/src/timergettime.c')
-rw-r--r--cpukit/posix/src/timergettime.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
index 3187dc8826..bb39121b81 100644
--- a/cpukit/posix/src/timergettime.c
+++ b/cpukit/posix/src/timergettime.c
@@ -1,7 +1,7 @@
/*
* 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267
*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -40,6 +40,7 @@ int timer_gettime(
POSIX_Timer_Control *ptimer;
Objects_Locations location;
struct timespec current_time;
+ Watchdog_Interval left;
if ( !value )
rtems_set_errno_and_return_minus_one( EINVAL );
@@ -54,11 +55,11 @@ int timer_gettime(
/* Calculates the time left before the timer finishes */
- _Timespec_Subtract(
- &ptimer->timer_data.it_value,
- &current_time,
- &value->it_value
- );
+ left =
+ (ptimer->Timer.start_time + ptimer->Timer.initial) - /* expire */
+ _Watchdog_Ticks_since_boot; /* now */
+
+ _Timespec_From_ticks( left, &value->it_value );
value->it_interval = ptimer->timer_data.it_interval;