diff options
Diffstat (limited to 'cpukit/posix/src/clocknanosleep.c')
-rw-r--r-- | cpukit/posix/src/clocknanosleep.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cpukit/posix/src/clocknanosleep.c b/cpukit/posix/src/clocknanosleep.c index 3fa890fecd..43f15346de 100644 --- a/cpukit/posix/src/clocknanosleep.c +++ b/cpukit/posix/src/clocknanosleep.c @@ -82,6 +82,15 @@ int clock_nanosleep( rmtp = NULL; } else { absolute = false; + + /* + * A relative CLOCK_REALTIME time out shall not be affected by + * CLOCK_REALTIME changes through clock_settime(). Since our + * CLOCK_REALTIME is basically just CLOCK_MONOTONIC plus an offset, we can + * simply use the CLOCK_MONOTONIC watchdog for relative CLOCK_REALTIME time + * outs. + */ + clock_id = CLOCK_MONOTONIC; } if ( clock_id == CLOCK_REALTIME ) { @@ -118,11 +127,8 @@ int clock_nanosleep( struct timespec actual_end; struct timespec planned_end; - if ( clock_id == CLOCK_REALTIME ) { - _Timecounter_Nanotime( &actual_end ); - } else { - _Timecounter_Nanouptime( &actual_end ); - } + _Assert( clock_id == CLOCK_MONOTONIC ); + _Timecounter_Nanouptime( &actual_end ); _Watchdog_Ticks_to_timespec( executing->Timer.Watchdog.expire, |