Skip to content

Commit 7514a63

Browse files
committed
posix + tests: correct timing functions to use CLOCK_REALTIME
Use `CLOCK_REALTIME` by default as per the POSIX specification for the following functions: * `mq_timedreceive()` * `mq_timedsend()` * `pthread_cond_timedwait()` * `pthread_mutex_timedlock()` * `pthread_rwlock_timedrdlock()` * `pthread_rwlock_timedwrlock()` * `sem_timedwait()` and additionally for the following non-portable functions: * `pthread_timedjoin_np()` Signed-off-by: Chris Friedt <[email protected]>
1 parent ccfce57 commit 7514a63

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/posix/options/posix_internal.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,24 @@ static inline bool tp_diff_in_range_ns(const struct timespec *a, const struct ti
166166
*
167167
* Convert the absolute time specified by @p abstime with respect to @p clock to a relative
168168
* timeout in milliseconds. The result is the number of milliseconds until the specified time,
169+
<<<<<<< HEAD
169170
* clamped to the range [0, `INT32_MAX`] so that if @p abstime specifies a timepoint in the past,
171+
=======
172+
* clamped to the range [0, `INT64_MAX`] so that if @p abstime specifies a timepoint in the past,
173+
>>>>>>> 4def3d81eaf (posix + tests: correct timing functions to use CLOCK_REALTIME)
170174
* the result timeout is 0. If the clock specified by @p clock is not supported, the function
171175
* returns 0.
172176
*
173177
* @param clock The clock ID to use for conversion, e.g. `CLOCK_REALTIME`, or `CLOCK_MONOTONIC`.
174178
* @param abstime The absolute time to convert.
179+
<<<<<<< HEAD
175180
* @return The relative timeout in milliseconds clamped to the range [0, `INT32_MAX`].
176181
*/
177182
uint32_t timespec_to_timeoutms(clockid_t clock, const struct timespec *abstime);
183+
=======
184+
* @return The relative timeout in milliseconds clamped to the range [0, `INT64_MAX`].
185+
*/
186+
uint64_t timespec_to_timeoutms(clockid_t clock, const struct timespec *abstime);
187+
>>>>>>> 4def3d81eaf (posix + tests: correct timing functions to use CLOCK_REALTIME)
178188

179189
#endif

0 commit comments

Comments
 (0)