468. Period of detention undergone by accused to be set off against sentence of imprisonment.
(1) Where an accused person has, on conviction, been sentenced to imprisonment for a term, not being imprisonment in default of payment of fine, the period of detention, if any, undergone by him during the investigation, inquiry or trial of the same case and before the date of such conviction, shall be set off against the term of imprisonment imposed on him on such conviction, and the liability of such person to undergo imprisonment on such conviction shall be restricted to the remainder, if any, of the term of imprisonment imposed on him:
Provided that in cases referred to in section 467, such period of detention shall be set off against the period of imprisonment which would but for the said section 467 be imposed on him.
(2) Where such person has been detained for a period longer than the term of imprisonment to which he is sentenced on conviction, the Court may order the payment of such amount of compensation to him as it may deem fit.