[PATCH 2/3] rtems: Use rtems_clock_get_ticks_per_second()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue May 11 15:38:14 UTC 2021


This avoids an integer division at runtime.
---
 cpukit/rtems/src/clocktodvalidate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/src/clocktodvalidate.c b/cpukit/rtems/src/clocktodvalidate.c
index d8e9d01382..95c8e77c37 100644
--- a/cpukit/rtems/src/clocktodvalidate.c
+++ b/cpukit/rtems/src/clocktodvalidate.c
@@ -46,8 +46,8 @@ rtems_status_code _TOD_Validate(
     return RTEMS_INVALID_ADDRESS;
   }
 
-  ticks_per_second = TOD_MICROSECONDS_PER_SECOND /
-	    rtems_configuration_get_microseconds_per_tick();
+  ticks_per_second = rtems_clock_get_ticks_per_second();
+
   if ((the_tod->ticks  >= ticks_per_second)       ||
       (the_tod->second >= TOD_SECONDS_PER_MINUTE) ||
       (the_tod->minute >= TOD_MINUTES_PER_HOUR)   ||
-- 
2.26.2



More information about the devel mailing list