I suspect it probably won't apply to your project, but the 32-bit long millis() function wraps around every 49.7 days or so. If you used micros() which gives you time in microseconds instead, that would wrap around in a little over 1.15 hours. However, if you eventually need to write a long running application, you would need to handle the wrap around.
The code, as written, works across the wrap-around.
If switched to micros() it would still work across the wrap-around.
If you doubt it, do the math yourself (like I did years ago).
