sys/ztimer: make ztimer_overhead() return signed result #13571
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
Current ztimer_overhead() overflows if the timer triggers too early. Fix to return
int32_t
.Also updates
tests/ztimer_overhead
(only user of the function).Testing procedure
Override the adjust value for building to see an effect with or without this PR:
CFLAGS="-DCONFIG_ZTIMER_USEC_ADJUST=100" make -Ctests/ztimer_overhead
.Without #13570, maybe manually addZTIMER_USEC->adjust = 100
, in main.c before the main loop.Issues/PRs references
#13549 also works with signed overhead.