diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-08-01 09:03:11 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-08-04 07:55:30 +0200 |
commit | c64c638f6dee6c0e92804bbe378ff91cc75f620e (patch) | |
tree | 176ef9ed40dc357a917a8c63af264ecf23706706 /cpukit | |
parent | libmisc/shell: Add an 'rtems' command to report a running build (diff) | |
download | rtems-c64c638f6dee6c0e92804bbe378ff91cc75f620e.tar.bz2 |
posix: Fix relative CLOCK_REALTIME sleep
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.
Update #4690.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/posix/src/clocknanosleep.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cpukit/posix/src/clocknanosleep.c b/cpukit/posix/src/clocknanosleep.c index 3fa890fecd..bfa8ef7975 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 ) { |