We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c1f3e42 + feefff5 commit f352c28Copy full SHA for f352c28
src/arduino-timer.h
@@ -41,6 +41,8 @@
41
#include <WProgram.h>
42
#endif
43
44
+#include <limits.h>
45
+
46
#ifndef TIMER_MAX_TASKS
47
#define TIMER_MAX_TASKS 0x10
48
@@ -142,7 +144,7 @@ class Timer {
142
144
unsigned long
143
145
ticks() const
146
{
- unsigned long ticks = (unsigned long)-1, elapsed;
147
+ unsigned long ticks = ULONG_MAX, elapsed;
148
const unsigned long start = time_func();
149
150
timer_foreach_const_task(task) {
@@ -162,7 +164,7 @@ class Timer {
162
164
163
165
elapsed = time_func() - start;
166
- if (elapsed >= ticks || ticks == (unsigned long)-1) ticks = 0;
167
+ if (elapsed >= ticks || ticks == ULONG_MAX) ticks = 0;
168
else ticks -= elapsed;
169
170
return ticks;
0 commit comments