Calculating the time between the signal when its ON and when it gets OFF
I suspect secs is 0 sometimes, because of _rise being 0? In that case unsigned int subtraction causes this: secs(0) - 4 = -4 % 2^32, resulting in your 4294967292