[rtems-central commit] spec: Fix relative CLOCK_REALTIME sleep
Sebastian Huber
sebh at rtems.org
Thu Aug 4 05:53:25 UTC 2022
Module: rtems-central
Branch: master
Commit: 11121d0280b9f8ebb45d3793f14e10cd4062c4bf
Changeset: http://git.rtems.org/rtems-central/commit/?id=11121d0280b9f8ebb45d3793f14e10cd4062c4bf
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Aug 4 07:59:49 2022 +0200
spec: 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.
---
spec/c/req/clock-nanosleep.yml | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/spec/c/req/clock-nanosleep.yml b/spec/c/req/clock-nanosleep.yml
index e2c62514..6aa11df6 100644
--- a/spec/c/req/clock-nanosleep.yml
+++ b/spec/c/req/clock-nanosleep.yml
@@ -69,12 +69,7 @@ post-conditions:
the ``rqtp`` parameter.
- name: Relative
test-code: |
- if ( ctx->clock_id == CLOCK_REALTIME ) {
- expire = ctx->now_realtime;
- } else {
- expire = ctx->now_monotonic;
- }
-
+ expire = ctx->now_monotonic;
expire.tv_sec += ctx->rqtp_obj.tv_sec;
expire.tv_nsec += ctx->rqtp_obj.tv_nsec;
@@ -87,8 +82,9 @@ post-conditions:
T_eq_long( ctx->timer_info.expire_timespec.tv_nsec, expire.tv_nsec );
text: |
The timer of the calling task shall expire at the time point specified by
- the sum of the current time of the clock specified by the ``clock_id``
- parameter and the interval specified by the ``rqtp`` parameter.
+ the sum of the current time of the clock specified by
+ ${../if/clock-monotonic:/name} and the interval specified by the ``rqtp``
+ parameter.
test-epilogue: null
test-prologue: |
struct timespec expire;
@@ -463,7 +459,7 @@ transition-map:
pre-conditions:
RQTpSec: PastOrNow
then: Inactive
- - specified-by: ClockId
+ - else: Monotonic
Expire:
- if:
pre-conditions:
More information about the vc
mailing list