The first two lines are there to deal with the fact that millis() and micros() will wrap around to zero after a while. Since they're unsigned longs, the maximum value is 2^32 - 1, or 4294967295, so if millis()/micros() is less than the last snapshot taken, the millis()/micros() value has wrapped to zero and we have to subtract the last snapshot time from that limit to bring it back into range. If this isn't done, the time-delayed code may never fire again once the millis() or micros() value wraps to zero!
Come on - have you ever seen it done this way? have you looked at blink without delay? That’s a very poor recommendation.
Next, we have the comparison that determines how long to wait before executing the code inside the "if" condition. In the example we're waiting for millis() to exceed the previous millis() reading plus 150 milliseconds,
That’s a bad recommendation as well... what if adding 150 actually overflows and goes back to 0 (/a small number), then you trigger right away...
Just go do if (millis()-snapshot_time > 150) {...
As long as you are using unsigned long for snapshot_time you will be fine even when millis() goes back to 0 because the subtraction is done with unsigned numbers. Don’t do addition, go for subtraction
Hopefully you are not dumping all over the forum lame recommendations and poor coding technics... looks you have not done even the basic research on that one.
No one wanting good code should follow this recommendation