Skip to content

Commit 9751900

Browse files
cfriedtnashif
authored andcommitted
sys: clock: re-apply change to Z_IS_TIMEOUT_RELATIVE
A mid-air collision between two different changes to sys_clock.h resulted in a test failure. ```shell tests/kernel/timer/timer_api/src/main.c:763: timer_api_test_timeout_abs: Z_IS_TIMEOUT_RELATIVE(t2) is false ``` Re-apply the change that was added in 9075d53 to keep tests running smoothly. Signed-off-by: Chris Friedt <[email protected]>
1 parent f2c37c4 commit 9751900

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

include/zephyr/sys/clock.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ typedef struct {
151151

152152
/* Test for relative timeout */
153153
#if CONFIG_TIMEOUT_64BIT
154-
#define Z_IS_TIMEOUT_RELATIVE(timeout) (Z_TICK_ABS((timeout).ticks) < 0)
154+
/* Positive values are relative/delta timeouts and negative values are absolute
155+
* timeouts, except -1 which is reserved for K_TIMEOUT_FOREVER. 0 is K_NO_WAIT,
156+
* which is historically considered a relative timeout.
157+
* K_TIMEOUT_FOREVER is not considered a relative timeout and neither is it
158+
* considerd an absolute timeouts (so !Z_IS_TIMEOUT_RELATIVE() does not
159+
* necessarily mean it is an absolute timeout if ticks == -1);
160+
*/
161+
#define Z_IS_TIMEOUT_RELATIVE(timeout) (((timeout).ticks) >= 0)
155162
#else
156163
#define Z_IS_TIMEOUT_RELATIVE(timeout) true
157164
#endif

0 commit comments

Comments
 (0)