Anticipation of the switch-off and delay of the switch-on of a laser with a swept parameter