Module: xenomai-forge
Branch: master
Commit: 01b4c5e643efe5371d1d73dc103fb322bc3fd381
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=01b4c5e643efe5371d1d73dc103fb322bc3fd381

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Nov 26 16:55:37 2011 +0100

copperplate/clockobj: clockobj_ticks_to_clock() -> clockobj_convert_clocks()

We rename this conversion call to fix a misnomer, taking a timespec
for input instead of a count of ticks, since most callers will want to
pass this.

CAUTION: The input value shall be based on CLOCK_COPPERPLATE, so this
is really a conversion routine from CLOCK_COPPERPLATE to other clock.

---

 include/copperplate/clockobj.h |    6 +++---
 lib/copperplate/clockobj.c     |   15 +++++++--------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/include/copperplate/clockobj.h b/include/copperplate/clockobj.h
index 7537c01..39cb79d 100644
--- a/include/copperplate/clockobj.h
+++ b/include/copperplate/clockobj.h
@@ -113,10 +113,10 @@ void clockobj_ticks_to_caltime(struct clockobj *clkobj,
                               struct tm *tm,
                               unsigned long *rticks);
 
-void clockobj_ticks_to_clock(struct clockobj *clkobj,
-                            ticks_t ticks,
+void clockobj_convert_clocks(struct clockobj *clkobj,
+                            const struct timespec *in,
                             clockid_t clk_id,
-                            struct timespec *timeout);
+                            struct timespec *out);
 
 int clockobj_set_resolution(struct clockobj *clkobj,
                            unsigned int resolution_ns);
diff --git a/lib/copperplate/clockobj.c b/lib/copperplate/clockobj.c
index d40a79c..48f6eab 100644
--- a/lib/copperplate/clockobj.c
+++ b/lib/copperplate/clockobj.c
@@ -370,22 +370,21 @@ void clockobj_get_date(struct clockobj *clkobj, ticks_t 
*pticks)
 
 #endif /* CONFIG_XENO_MERCURY */
 
-void clockobj_ticks_to_clock(struct clockobj *clkobj,
-                            ticks_t ticks,
+/* Conversion from CLOCK_COPPERPLATE to clk_id. */
+void clockobj_convert_clocks(struct clockobj *clkobj,
+                            const struct timespec *in,
                             clockid_t clk_id,
-                            struct timespec *timeout)
+                            struct timespec *out)
 {
-       struct timespec ts, now;
+       struct timespec now, delta;
 
        __RT(clock_gettime(CLOCK_COPPERPLATE, &now));
-       /* Absolute timeout, CLOCK_COPPERPLATE-based. */
-       __clockobj_ticks_to_timespec(clkobj, ticks, &ts);
        /* Offset from CLOCK_COPPERPLATE epoch. */
-       timespec_sub(timeout, &ts, &now);
+       timespec_sub(&delta, in, &now);
        /* Current time for clk_id. */
        __RT(clock_gettime(clk_id, &now));
        /* Absolute timeout again, clk_id-based this time. */
-       timespec_add(timeout, timeout, &now);
+       timespec_add(out, &delta, &now);
 }
 
 int clockobj_init(struct clockobj *clkobj,


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to