fix: bound timer counter to uint max on fail

This commit is contained in:
2026-05-16 18:10:31 +02:00
parent 3b6d4d642d
commit 6a7c9b3aab
+2 -1
View File
@@ -1,3 +1,4 @@
#include <limits.h>
#include <time.h>
#include "types.h"
@@ -12,7 +13,7 @@ void timer_init(Timer *timer, const unsigned int target) {
bool timer_inc(Timer *timer) {
timer->counter += 1;
return timer->counter >= timer->target;
return timer->counter == UINT_MAX || timer->counter >= timer->target;
}
double timer_reset(Timer *timer) {