[PATCH 6/7] kernel: cobalt: migrate to ktime_t

roman.stratiienko at globallogic.com roman.stratiienko at globallogic.com
Tue Mar 5 15:45:20 CET 2019


From: Roman Stratiienko <roman.stratiienko at globallogic.com>

Signed-off-by: Roman Stratiienko <roman.stratiienko at globallogic.com>
---
 kernel/cobalt/clock.c                 | 4 +---
 kernel/drivers/analogy/rtdm_helpers.c | 5 +----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 272db3241..f8291b006 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -350,9 +350,7 @@ EXPORT_SYMBOL_GPL(xnclock_adjust);
 
 xnticks_t xnclock_get_host_time(void)
 {
-	struct timeval tv;
-	do_gettimeofday(&tv);
-	return tv.tv_sec * 1000000000ULL + tv.tv_usec * 1000;
+	return ktime_to_ns(ktime_get_real());
 }
 EXPORT_SYMBOL_GPL(xnclock_get_host_time);
 
diff --git a/kernel/drivers/analogy/rtdm_helpers.c b/kernel/drivers/analogy/rtdm_helpers.c
index 8330d0676..675594152 100644
--- a/kernel/drivers/analogy/rtdm_helpers.c
+++ b/kernel/drivers/analogy/rtdm_helpers.c
@@ -32,11 +32,8 @@ static nanosecs_abs_t a4l_clkofs;
 void a4l_init_time(void)
 {
 	nanosecs_abs_t t1, t2;
-	struct timeval tv;
 	t1 = rtdm_clock_read();
-	do_gettimeofday(&tv);
-	t2 = 1000000000 * ((nanosecs_abs_t)tv.tv_sec) +
-		1000000 * ((nanosecs_abs_t)tv.tv_usec);
+	t2 = ktime_to_ns(ktime_get_real());
 	a4l_clkofs = t2 - t1;
 }
 
-- 
2.17.1




More information about the Xenomai mailing list