summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/clockset.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-29 09:55:54 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-29 09:55:54 +0000
commit8d7aea0d28cd7504ea406537040d1bbe2f634a29 (patch)
tree5f9247e2d03b415da2ea560334f8f70ed332be0d /cpukit/rtems/src/clockset.c
parent2011-09-29 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-8d7aea0d28cd7504ea406537040d1bbe2f634a29.tar.bz2
2011-09-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
* score/include/rtems/score/tod.h: Declare _TOD_Set_with_timestamp() and _TOD_Get_as_timestamp(). * score/src/coretodset.c: Define _TOD_Set_with_timestamp(). * score/src/coretodget.c: Define _TOD_Get_as_timestamp(). * rtems/src/clockset.c: Use _TOD_Set_with_timestamp(). * score/include/rtems/score/timestamp64.h, score/src/ts64set.c: Changed parameter types of _Timestamp64_Set(). * rtems/src/clocktodtoseconds.c: Year 2100 is not a leap year.
Diffstat (limited to 'cpukit/rtems/src/clockset.c')
-rw-r--r--cpukit/rtems/src/clockset.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c
index b70e42e165..4c055d5b54 100644
--- a/cpukit/rtems/src/clockset.c
+++ b/cpukit/rtems/src/clockset.c
@@ -30,7 +30,7 @@
* This directive sets the date and time for this node.
*
* Input parameters:
- * time_buffer - pointer to the time and date structure
+ * tod - pointer to the time and date structure
*
* Output parameters:
* RTEMS_SUCCESSFUL - if successful
@@ -38,23 +38,26 @@
*/
rtems_status_code rtems_clock_set(
- const rtems_time_of_day *time_buffer
+ const rtems_time_of_day *tod
)
{
- struct timespec newtime;
-
- if ( !time_buffer )
+ if ( !tod )
return RTEMS_INVALID_ADDRESS;
- if ( _TOD_Validate( time_buffer ) ) {
- newtime.tv_sec = _TOD_To_seconds( time_buffer );
- newtime.tv_nsec = time_buffer->ticks *
- rtems_configuration_get_nanoseconds_per_tick();
+ if ( _TOD_Validate( tod ) ) {
+ Timestamp_Control tod_as_timestamp;
+ uint32_t seconds = _TOD_To_seconds( tod );
+ uint32_t nanoseconds = tod->ticks
+ * rtems_configuration_get_nanoseconds_per_tick();
+
+ _Timestamp_Set( &tod_as_timestamp, seconds, nanoseconds );
_Thread_Disable_dispatch();
- _TOD_Set( &newtime );
+ _TOD_Set_with_timestamp( &tod_as_timestamp );
_Thread_Enable_dispatch();
+
return RTEMS_SUCCESSFUL;
}
+
return RTEMS_INVALID_CLOCK;
}