Skip to content

Commit b69dc02

Browse files
committed
ztimerset: Make selftest more reliable
On Windows, the `Sleep()` function resolution (which is used by `zclock_sleep()`) can typically be as bad as 16 ms. This caused the selftest to randomly fail because it waited exactly the remaining time to the timer expiration before asserting the result. Made this more reliable by adding some margin to the sleep.
1 parent 8e4f37d commit b69dc02

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ztimerset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ ztimerset_test (bool verbose)
181181
assert (!timer_invoked);
182182
int timeout = ztimerset_timeout (self);
183183
assert (timeout > 0);
184-
zclock_sleep (timeout);
184+
zclock_sleep (timeout + 20);
185185
rc = ztimerset_execute (self);
186186
assert (rc == 0);
187187
assert (timer_invoked);

0 commit comments

Comments
 (0)