Complex Rule optimization

I don’t have time to do a full analysis but the general approach is to put the test in a separate rule that there when ever one of the values changes, and put the result into an item. See Design Pattern: Separation of Behaviors and for a more specific example for using this approach on time see Design Pattern: Simple State Machine (e.g. Time Of Day).

Generic Presence Detection may also be of interest.