From 2256946e9c0bc452004521d7aeeb68b72f680f42 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 6 Oct 2017 15:30:47 +0200 Subject: score: Use struct timespec for TOD Use the timestamps only for uptime based values. Use struct timespec for the absolute time values (TOD). Update #2740. --- cpukit/rtems/src/clockset.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'cpukit/rtems/src/clockset.c') diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c index f0300cc76a..d77268211b 100644 --- a/cpukit/rtems/src/clockset.c +++ b/cpukit/rtems/src/clockset.c @@ -30,19 +30,16 @@ rtems_status_code rtems_clock_set( return RTEMS_INVALID_ADDRESS; if ( _TOD_Validate( tod ) ) { - Timestamp_Control tod_as_timestamp; - uint32_t seconds; - uint32_t nanoseconds; - ISR_lock_Context lock_context; + struct timespec tod_as_timespec; + ISR_lock_Context lock_context; - seconds = _TOD_To_seconds( tod ); - nanoseconds = tod->ticks + tod_as_timespec.tv_sec = _TOD_To_seconds( tod ); + tod_as_timespec.tv_nsec = tod->ticks * rtems_configuration_get_nanoseconds_per_tick(); - _Timestamp_Set( &tod_as_timestamp, seconds, nanoseconds ); _TOD_Lock(); _TOD_Acquire( &lock_context ); - _TOD_Set( &tod_as_timestamp, &lock_context ); + _TOD_Set( &tod_as_timespec, &lock_context ); _TOD_Unlock(); return RTEMS_SUCCESSFUL; -- cgit v1.2.3