Any prisoner placed in a hospital or medical facility under section one hundred and seventeen, one hundred and seventeen A or one hundred and eighteen shall, during his absence from prison or the jail or house of correction, be considered as in the custody of the officer having charge of the prison, jail or house of correction, and the time of confinement in said hospital or medical facility shall be considered as part of the term of sentence.
Mass. Gen. Laws ch. 127, § 119