Suppose that I have a time limit of one day with JuMP and CPLEX:

using JuMP, CPLEX, Dates
set_optimizer_attributes(model, "CPX_PARAM_TILIM" => Dates.value(Second(Day(1))) # CPU limit in seconds

Can I also have another time limit, let us say n hours, for instance 2 hours such that, if the gap doesn’t improve enough for 2 hours, the model stops? Suppose that the gap only improves from 6.069% to 6.061% during 2 hours (less than a percent), can I make my model JuMP model stop?

If that is not possible, is there a way to stop the model if the gap stays constant for let us say 20 minutes? i.e. both the incumbent and the best bound doesn’t improve for 20 minutes.