score: Return status in _TOD_Adjust()

This commit is contained in:
Sebastian Huber
2021-09-03 09:33:01 +02:00
parent fbd0a3cec3
commit 8abd175669
3 changed files with 14 additions and 4 deletions

View File

@@ -337,8 +337,11 @@ RTEMS_INLINE_ROUTINE void _TOD_Get_timeval(
* specified amount.
*
* @param delta is the amount to adjust.
*
* @retval STATUS_SUCCESSFUL Successful operation.
* @retval other Some error occurred.
*/
void _TOD_Adjust(
Status_Control _TOD_Adjust(
const struct timespec *delta
);

View File

@@ -44,6 +44,7 @@ int adjtime(
)
{
struct timespec delta_as_timespec;
Status_Control status;
/*
* Simple validations
@@ -83,7 +84,10 @@ int adjtime(
/*
* Now apply the adjustment
*/
_TOD_Adjust( &delta_as_timespec );
status = _TOD_Adjust( &delta_as_timespec );
if ( status != STATUS_SUCCESSFUL ) {
rtems_set_errno_and_return_minus_one( STATUS_GET_POSIX( status ) );
}
return 0;
}

View File

@@ -22,12 +22,13 @@
#include <rtems/score/todimpl.h>
void _TOD_Adjust(
Status_Control _TOD_Adjust(
const struct timespec *delta
)
{
ISR_lock_Context lock_context;
struct timespec tod;
Status_Control status;
/*
* Currently, RTEMS does the adjustment in one movement.
@@ -41,6 +42,8 @@ void _TOD_Adjust(
_TOD_Acquire( &lock_context );
_TOD_Get( &tod );
_Timespec_Add_to( &tod, delta );
_TOD_Set( &tod, &lock_context );
status = _TOD_Set( &tod, &lock_context );
_TOD_Unlock();
return status;
}