summaryrefslogtreecommitdiffstats
path: root/cpukit/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-03 09:46:36 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-06 12:22:44 +0200
commit54b4b1f85af465acb4627ec423599a6c3b4a6fad (patch)
treef3bad4aa3f81fc8edee24fdb5c1138f39f128297 /cpukit/include
parentscore: Remove TOD_TICKS_PER_SECOND_method() (diff)
downloadrtems-54b4b1f85af465acb4627ec423599a6c3b4a6fad.tar.bz2
score: Add _TOD_Is_valid_new_time_of_day()
Move the TOD validation to the callers of _TOD_Set(). This avoids dead code in case only rtems_clock_set() is used in an application because rtems_clock_set() always calls _TOD_Set() with a valid time of day.
Diffstat (limited to 'cpukit/include')
-rw-r--r--cpukit/include/rtems/score/todimpl.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/cpukit/include/rtems/score/todimpl.h b/cpukit/include/rtems/score/todimpl.h
index 5346f12e53..ceeef2e21b 100644
--- a/cpukit/include/rtems/score/todimpl.h
+++ b/cpukit/include/rtems/score/todimpl.h
@@ -207,12 +207,24 @@ static inline void _TOD_Release( ISR_lock_Context *lock_context )
}
/**
+ * @brief Checks the time point is a valid new time of day for _TOD_Set().
+ *
+ * @param tod the time of day to check.
+ *
+ * @retval STATUS_SUCCESSFUL The time of day is valid.
+ *
+ * @retval STATUS_INVALID_NUMBER The time of day is invalid.
+ */
+Status_Control _TOD_Is_valid_new_time_of_day( const struct timespec *tod );
+
+/**
* @brief Sets the time of day.
*
* The caller must be the owner of the TOD lock.
*
* @param tod The new time of day in timespec format representing
- * the time since UNIX Epoch.
+ * the time since UNIX Epoch. The new time of day shall be valid according
+ * to _TOD_Is_valid_new_time_of_day().
* @param lock_context The ISR lock context used for the corresponding
* _TOD_Acquire(). The caller must be the owner of the TOD lock. This
* function will release the TOD lock.