is there a bug in "blink without delay" scetch?

Hy guys.

What happens with the popular example when the millis overflow:

 if (currentMillis - previousMillis >= interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;

let say currentMillis get to 50 days - previousMillis=49 days >=interval 2 days.

then currentMillis overflow.

now we have (0-49 days>=2 day) and the script will wait for 49 days instead of interval of 2 days, correct?

That is the beauty of binary calculation. If two unsigned long variables are used, and one has rollover, and they are substracted, then the result is still the difference.
But they have to be unsigned long, if one of them is a "long", then it won't work. The variable of the interval however doesn't have to be unsigned long.

There are some test sketches on this forum to test it. I could not find them right now.

If you have a question about something, please give links to the origin. For example: Blink Without Delay : https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay

Thanks for the quick answer Koepel (y)