summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/coretodadjust.c
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/score/src/coretodadjust.c
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/score/src/coretodadjust.c')
-rw-r--r--cpukit/score/src/coretodadjust.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpukit/score/src/coretodadjust.c b/cpukit/score/src/coretodadjust.c
index 90c99803e1..b048aeee71 100644
--- a/cpukit/score/src/coretodadjust.c
+++ b/cpukit/score/src/coretodadjust.c
@@ -42,7 +42,12 @@ Status_Control _TOD_Adjust(
_TOD_Acquire( &lock_context );
_TOD_Get( &tod );
_Timespec_Add_to( &tod, delta );
- status = _TOD_Set( &tod, &lock_context );
+ status = _TOD_Is_valid_new_time_of_day( &tod );
+
+ if ( status == STATUS_SUCCESSFUL ) {
+ status = _TOD_Set( &tod, &lock_context );
+ }
+
_TOD_Unlock();
return status;