It will wait till the point where it can reach Shimla before sunset. The schedule of crossings with return trains goes haywire if it's rescheduled. This isn't a BG section. For out of place crossings, trains may have to wait for hours for a single crossing.