diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-03 09:46:36 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-06 12:22:44 +0200 |
commit | 54b4b1f85af465acb4627ec423599a6c3b4a6fad (patch) | |
tree | f3bad4aa3f81fc8edee24fdb5c1138f39f128297 /cpukit/posix/src/clocksettime.c | |
parent | score: Remove TOD_TICKS_PER_SECOND_method() (diff) | |
download | rtems-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 '')
-rw-r--r-- | cpukit/posix/src/clocksettime.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cpukit/posix/src/clocksettime.c b/cpukit/posix/src/clocksettime.c index 53e728762e..23bb14a86d 100644 --- a/cpukit/posix/src/clocksettime.c +++ b/cpukit/posix/src/clocksettime.c @@ -41,6 +41,11 @@ int clock_settime( if ( clock_id == CLOCK_REALTIME ) { ISR_lock_Context lock_context; + status = _TOD_Is_valid_new_time_of_day( tp ); + if ( status != STATUS_SUCCESSFUL ) { + rtems_set_errno_and_return_minus_one( STATUS_GET_POSIX( status ) ); + } + _TOD_Lock(); _TOD_Acquire( &lock_context ); status = _TOD_Set( tp, &lock_context ); |