When a railroad company is restrained by any court from the discharge of a duty imposed upon it or the exercise of a privilege which it is authorized to exercise and there is a limited time wherein such duty is to be discharged or privilege exercised, the time during which the restraint exists shall not be computed as a portion of such limited time.