Where any person detained in naval detention quarters or in a military or air-force establishment in pursuance of a sentence of imprisonment or detention passed on him under this Part of this Act is released on compassionate grounds in pursuance of Naval Detention Quarters Rules, or Imprisonment and Detention Rules made under the Army Act, 1955, or the Air Force Act, 1955, as the case may be, no account shall be taken, in calculating the period for which he is liable to be detained under his sentence, of the period beginning with the day after that on which he is so released and ending with the day on which he is required to return to custody.