summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-06 15:30:47 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-09 08:30:03 +0200
commit2256946e9c0bc452004521d7aeeb68b72f680f42 (patch)
tree1a46bee10c6e92482125405b902ab75bfd8fd5e9 /cpukit/posix/src
parentscore: Simplify _Timestamp_Add_to() (diff)
downloadrtems-2256946e9c0bc452004521d7aeeb68b72f680f42.tar.bz2
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.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r--cpukit/posix/src/clockgettime.c2
-rw-r--r--cpukit/posix/src/clocksettime.c7
-rw-r--r--cpukit/posix/src/timersettime.c4
3 files changed, 9 insertions, 4 deletions
diff --git a/cpukit/posix/src/clockgettime.c b/cpukit/posix/src/clockgettime.c
index b3adbc4713..4f6c583ff1 100644
--- a/cpukit/posix/src/clockgettime.c
+++ b/cpukit/posix/src/clockgettime.c
@@ -37,7 +37,7 @@ int clock_gettime(
rtems_set_errno_and_return_minus_one( EINVAL );
if ( clock_id == CLOCK_REALTIME ) {
- _TOD_Get_as_timespec(tp);
+ _TOD_Get(tp);
return 0;
}
#ifdef CLOCK_MONOTONIC
diff --git a/cpukit/posix/src/clocksettime.c b/cpukit/posix/src/clocksettime.c
index 8eb616c8b5..a0fdd9109f 100644
--- a/cpukit/posix/src/clocksettime.c
+++ b/cpukit/posix/src/clocksettime.c
@@ -36,10 +36,15 @@ int clock_settime(
rtems_set_errno_and_return_minus_one( EINVAL );
if ( clock_id == CLOCK_REALTIME ) {
+ ISR_lock_Context lock_context;
+
if ( tp->tv_sec < TOD_SECONDS_1970_THROUGH_1988 )
rtems_set_errno_and_return_minus_one( EINVAL );
- _TOD_Set_with_timespec( tp );
+ _TOD_Lock();
+ _TOD_Acquire( &lock_context );
+ _TOD_Set( tp, &lock_context );
+ _TOD_Unlock();
}
#ifdef _POSIX_CPUTIME
else if ( clock_id == CLOCK_PROCESS_CPUTIME_ID )
diff --git a/cpukit/posix/src/timersettime.c b/cpukit/posix/src/timersettime.c
index 698a47a6b7..1f98a7a08c 100644
--- a/cpukit/posix/src/timersettime.c
+++ b/cpukit/posix/src/timersettime.c
@@ -39,7 +39,7 @@ static void _POSIX_Timer_Insert(
ptimer->state = POSIX_TIMER_STATE_CREATE_RUN;
/* Store the time when the timer was started again */
- _TOD_Get_as_timespec( &ptimer->time );
+ _TOD_Get( &ptimer->time );
_Watchdog_Insert(
&cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
@@ -132,7 +132,7 @@ int timer_settime(
/* Convert absolute to relative time */
if (flags == TIMER_ABSTIME) {
struct timespec now;
- _TOD_Get_as_timespec( &now );
+ _TOD_Get( &now );
/* Check for seconds in the past */
if ( _Timespec_Greater_than( &now, &normalize.it_value ) )
rtems_set_errno_and_return_minus_one( EINVAL );