arduino-timer icon indicating copy to clipboard operation
arduino-timer copied to clipboard

Overloaded ticks() function, getting the ticks left for a specific task

Open sixtelgreg opened this issue 3 years ago • 1 comments
trafficstars

Signed-off-by: Greg [email protected]

sixtelgreg avatar Jan 21 '22 19:01 sixtelgreg

Is it a good idea to overload a function name for two conceptually different return values? ticks() returns ticks until next event vs ticks(t) returns ticks until end of t. IMHO, this function should have a distinct name.

A minor style comment...

-             if (duration >= t->expires)
-                 break;
-
-             lft = t->expires - duration;
-             break;
+             if (duration < t->expires)
+                 lft = t->expires - duration;
+             break;

skrobinson avatar Jan 25 '22 20:01 skrobinson