[PATCH 14/19] score: Streamline set time of day functions

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Apr 29 09:13:14 UTC 2016


Rename _TOD_Set() into _TOD_Set_with_timespec().  Rename
_TOD_Set_with_timestamp() into _TOD_Set().  This is now in line with
_TOD_Get() and _TOD_Get_as_timespec().  The timestamp is the canonical
format.
---
 cpukit/posix/src/clocksettime.c            |  2 +-
 cpukit/rtems/src/clockset.c                |  2 +-
 cpukit/score/include/rtems/score/todimpl.h | 25 +++++++++----------------
 cpukit/score/src/coretodadjust.c           |  2 +-
 cpukit/score/src/coretodset.c              |  2 +-
 5 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/cpukit/posix/src/clocksettime.c b/cpukit/posix/src/clocksettime.c
index a700ba9..4d3be3b 100644
--- a/cpukit/posix/src/clocksettime.c
+++ b/cpukit/posix/src/clocksettime.c
@@ -42,7 +42,7 @@ int clock_settime(
       rtems_set_errno_and_return_minus_one( EINVAL );
 
     _Thread_Disable_dispatch();
-      _TOD_Set( tp );
+      _TOD_Set_with_timespec( tp );
     _Thread_Enable_dispatch();
   }
 #ifdef _POSIX_CPUTIME
diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c
index e87f167..8d065b4 100644
--- a/cpukit/rtems/src/clockset.c
+++ b/cpukit/rtems/src/clockset.c
@@ -39,7 +39,7 @@ rtems_status_code rtems_clock_set(
     _Timestamp_Set( &tod_as_timestamp, seconds, nanoseconds );
 
     _Thread_Disable_dispatch();
-      _TOD_Set_with_timestamp( &tod_as_timestamp );
+      _TOD_Set( &tod_as_timestamp );
     _Thread_Enable_dispatch();
 
     return RTEMS_SUCCESSFUL;
diff --git a/cpukit/score/include/rtems/score/todimpl.h b/cpukit/score/include/rtems/score/todimpl.h
index b1f8a6d..2b07823 100644
--- a/cpukit/score/include/rtems/score/todimpl.h
+++ b/cpukit/score/include/rtems/score/todimpl.h
@@ -143,30 +143,23 @@ typedef struct {
 extern TOD_Control _TOD;
 
 /**
- *  @brief Sets the time of day from timestamp.
+ * @brief Sets the time of day.
  *
- *  The @a tod_as_timestamp timestamp represents the time since UNIX epoch.
- *  The watchdog seconds chain will be adjusted.
- *
- *  @param[in] tod_as_timestamp is the constant of the time of day as a timestamp
+ * @param tod_as_timestamp The new time of day in timestamp format representing
+ *   the time since UNIX Epoch.
  */
-void _TOD_Set_with_timestamp(
+void _TOD_Set(
   const Timestamp_Control *tod_as_timestamp
 );
 
 /**
- *  @brief Sets the time of day from timespec.
- *
- *  The @a tod_as_timestamp timestamp represents the time since UNIX epoch.
- *  The watchdog seconds chain will be adjusted.
+ * @brief Sets the time of day with timespec format.
  *
- *  In the process the input given as timespec will be transformed to FreeBSD
- *  bintime format to guarantee the right format for later setting it with a
- *  timestamp.
+ * @param tod_as_timespec The new time of day in timespec format.
  *
- *  @param[in] tod_as_timespec is the constant of the time of day as a timespec
+ * @see _TOD_Set().
  */
-static inline void _TOD_Set(
+static inline void _TOD_Set_with_timespec(
   const struct timespec *tod_as_timespec
 )
 {
@@ -177,7 +170,7 @@ static inline void _TOD_Set(
     tod_as_timespec->tv_sec,
     tod_as_timespec->tv_nsec
   );
-  _TOD_Set_with_timestamp( &tod_as_timestamp );
+  _TOD_Set( &tod_as_timestamp );
 }
 
 /**
diff --git a/cpukit/score/src/coretodadjust.c b/cpukit/score/src/coretodadjust.c
index 6097e20..51c10ec 100644
--- a/cpukit/score/src/coretodadjust.c
+++ b/cpukit/score/src/coretodadjust.c
@@ -44,7 +44,7 @@ void _TOD_Adjust(
 
     _Timestamp_Add_to( &tod, &delta );
 
-    _TOD_Set_with_timestamp( &tod );
+    _TOD_Set( &tod );
 
   _Thread_Enable_dispatch();
 }
diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c
index b2efc07..e11f47c 100644
--- a/cpukit/score/src/coretodset.c
+++ b/cpukit/score/src/coretodset.c
@@ -22,7 +22,7 @@
 #include <rtems/score/threaddispatch.h>
 #include <rtems/score/watchdogimpl.h>
 
-void _TOD_Set_with_timestamp(
+void _TOD_Set(
   const Timestamp_Control *tod_as_timestamp
 )
 {
-- 
1.8.4.5



More information about the devel mailing list