summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/clockset.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2019-11-12 09:33:41 -0600
committerJoel Sherrill <joel@rtems.org>2019-12-11 15:22:33 -0600
commit08bd7d36cee1b041d54ee9dbace86a1b810938af (patch)
tree18de7bd20167d7430c82810d375534c56dfedb91 /cpukit/rtems/src/clockset.c
parentpipe: Use condition variables (diff)
downloadrtems-08bd7d36cee1b041d54ee9dbace86a1b810938af.tar.bz2
Add TOD Hooks to allow BSP to take action when TOD is set
Two use cases were envisioned for this. 1) a BSP or application which desires to update a real-time clock when the RTEMS TOD is set. 2) a paravirtualized BSP can use this to propagate setting the time in an RTEMS application to the hosting environment. This enables the entire set of applications in the virtualized environments to have a single consistent TOD.
Diffstat (limited to 'cpukit/rtems/src/clockset.c')
-rw-r--r--cpukit/rtems/src/clockset.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c
index d77268211b..a885fe1169 100644
--- a/cpukit/rtems/src/clockset.c
+++ b/cpukit/rtems/src/clockset.c
@@ -26,6 +26,8 @@ rtems_status_code rtems_clock_set(
const rtems_time_of_day *tod
)
{
+ bool retval;
+
if ( !tod )
return RTEMS_INVALID_ADDRESS;
@@ -39,10 +41,13 @@ rtems_status_code rtems_clock_set(
_TOD_Lock();
_TOD_Acquire( &lock_context );
- _TOD_Set( &tod_as_timespec, &lock_context );
+ retval = _TOD_Set( &tod_as_timespec, &lock_context );
_TOD_Unlock();
- return RTEMS_SUCCESSFUL;
+ if ( retval == true ) {
+ return RTEMS_SUCCESSFUL;
+ }
+ return RTEMS_IO_ERROR;
}
return RTEMS_INVALID_CLOCK;