summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/timergettime.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-07 16:01:57 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-14 09:06:27 +0100
commit77e6eba7146ba2e2074b719eec01cc7c40bbe98b (patch)
treeec87c51ccd9c53cb65067a2a06a75d29b32387f3 /cpukit/posix/src/timergettime.c
parentpc386: Fix linker usage issues with -r and function sections (diff)
downloadrtems-77e6eba7146ba2e2074b719eec01cc7c40bbe98b.tar.bz2
score: Add and use _Objects_Get_local()
This simplifies the handling with local-only objects. Update #2555.
Diffstat (limited to 'cpukit/posix/src/timergettime.c')
-rw-r--r--cpukit/posix/src/timergettime.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
index 7f0015bf5e..66708e947b 100644
--- a/cpukit/posix/src/timergettime.c
+++ b/cpukit/posix/src/timergettime.c
@@ -41,40 +41,31 @@ int timer_gettime(
)
{
POSIX_Timer_Control *ptimer;
- Objects_Locations location;
ISR_lock_Context lock_context;
- Per_CPU_Control *cpu;
uint64_t now;
uint32_t remaining;
if ( !value )
rtems_set_errno_and_return_minus_one( EINVAL );
- ptimer = _POSIX_Timer_Get( timerid, &location, &lock_context );
- switch ( location ) {
+ ptimer = _POSIX_Timer_Get( timerid, &lock_context );
+ if ( ptimer != NULL ) {
+ Per_CPU_Control *cpu;
- case OBJECTS_LOCAL:
+ cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
+ now = cpu->Watchdog.ticks;
- cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
- now = cpu->Watchdog.ticks;
+ if ( now < ptimer->Timer.expire ) {
+ remaining = (uint32_t) ( ptimer->Timer.expire - now );
+ } else {
+ remaining = 0;
+ }
- if ( now < ptimer->Timer.expire ) {
- remaining = (uint32_t) ( ptimer->Timer.expire - now );
- } else {
- remaining = 0;
- }
+ _Timespec_From_ticks( remaining, &value->it_value );
+ value->it_interval = ptimer->timer_data.it_interval;
- _Timespec_From_ticks( remaining, &value->it_value );
- value->it_interval = ptimer->timer_data.it_interval;
-
- _POSIX_Timer_Release( cpu, &lock_context );
- return 0;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- break;
+ _POSIX_Timer_Release( cpu, &lock_context );
+ return 0;
}
rtems_set_errno_and_return_minus_one( EINVAL );