Module: xenomai-forge
Branch: next
Commit: 64395153b9db0e3dc92eae70926b0a76ddf75dd0
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=64395153b9db0e3dc92eae70926b0a76ddf75dd0

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Jul  2 19:03:08 2014 +0200

alchemy/task: fix rt_task_set_periodic()

---

 lib/alchemy/task.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/alchemy/task.c b/lib/alchemy/task.c
index 8de9257..f516e91 100644
--- a/lib/alchemy/task.c
+++ b/lib/alchemy/task.c
@@ -833,8 +833,17 @@ int rt_task_set_periodic(RT_TASK *task, RTIME idate, RTIME 
period)
 
        CANCEL_DEFER(svc);
 
-       clockobj_ticks_to_timespec(&alchemy_clock, idate, &its);
-       clockobj_ticks_to_timespec(&alchemy_clock, period, &pts);
+       if (period == TM_INFINITE) {
+               pts.tv_sec = 0;
+               pts.tv_nsec = 0;
+               its = pts;
+       } else {
+               clockobj_ticks_to_timespec(&alchemy_clock, period, &pts);
+               if (idate == TM_NOW)
+                       clock_gettime(CLOCK_REALTIME, &its);
+               else
+                       clockobj_ticks_to_timespec(&alchemy_clock, idate, &its);
+       }
 
        tcb = get_alchemy_task_or_self(task, &ret);
        if (tcb == NULL)


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

Reply via email to