mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
score: Return status in _TOD_Adjust()
This commit is contained in:
@@ -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
|
||||
);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user