adding or subtracting an hour, rtc stuff

Those are a lot of on times and off times. It seems that you should be using an array.

Also, I think that for midnight, you should not be using 24: you should be using 0. This is because the RTC (and, presumably, the RTC library as well) uses 0 for midnight, and you need to be consistent to get things to work.

I have several ways of dealing with time calculations. Any of them would involve repeating the calculation for each on and off time. Repeated calculations are difficult without using loops and arrays.