Module: xenomai-jki
Branch: for-forge
Commit: ae50d6aa377ad34f01f8de8fa1ab694a2573927a
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=ae50d6aa377ad34f01f8de8fa1ab694a2573927a

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Mon Feb 22 18:34:44 2016 +0100

cobalt/posix/timer: Return interval value also for stopped timers

If a timer is not running, it may still have a non-null interval value.
This has to be returned according to the standard.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 kernel/cobalt/posix/timer.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
index 5e77454..cf1c919 100644
--- a/kernel/cobalt/posix/timer.c
+++ b/kernel/cobalt/posix/timer.c
@@ -268,16 +268,14 @@ out:
 void __cobalt_timer_getval(struct xntimer *__restrict__ timer,
                           struct itimerspec *__restrict__ value)
 {
+       ns2ts(&value->it_interval, xntimer_interval(timer));
+
        if (!xntimer_running_p(timer)) {
                value->it_value.tv_sec = 0;
                value->it_value.tv_nsec = 0;
-               value->it_interval.tv_sec = 0;
-               value->it_interval.tv_nsec = 0;
-               return;
+       } else {
+               ns2ts(&value->it_value, xntimer_get_timeout(timer));
        }
-
-       ns2ts(&value->it_value, xntimer_get_timeout(timer));
-       ns2ts(&value->it_interval, xntimer_interval(timer));
 }
 
 static inline void


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to