Description
Describe the bug
Two issues in one:
-
The POSIX spec indicates that the default clock used for condition variables should be
CLOCK_REALTIME
. However, Zephyr effectively always usesCLOCK_MONOTONIC
. -
Additionally, when a
pthread_condattr_t
is initialized as using any clock id, the clock id in that attribute is ignored in subsequent calls topthread_cond_timedwait()
.
Please also mention any information which could help others to understand
the problem you're facing:
- What target platform are you using? any
- What have you tried to diagnose or workaround this issue? just inspeced the source
- Is this a regression? No
To Reproduce
Steps to reproduce the behavior:
Can fill in later, if necessary. It's pretty evident from the source though.
Expected behavior
Should be able to specify which clock to use for pthread_cond_timedwait()
, as long as POSIX_CLOCK_SELECTION
is enabled.
Impact
This will throw conformant applications a bit of a curveball in terms of timing expectations.
Logs and console output
Environment (please complete the following information):
- OS: any
- Toolchain (e.g Zephyr SDK, ...): Zephyr SDK v0.17.0
- Commit SHA or Version used: d453fb9
Additional context
Discovered in the context of #88547