if statement for delay

Note that start time of the event. In every iteration of loop check to see if the event has lasted long enough. If it meets that threshold perform your action.