Section 83. Deduction for time spent in custody on remand

The time the person charged has been deprived of liberty in connection with the case shall be deducted from the penalty pursuant to the provisions of this section. This also applies to deprivation of liberty abroad or on account of aspects of the case for which the person charged is acquitted, or which are dropped.
A deduction of one day shall be granted for each commenced day of deprivation of liberty after arrest that exceeds four hours. For deprivation of liberty in complete isolation exceeding four hours, a further deduction shall be granted equivalent to one day for each 48-hour period commenced while the convicted person was subjected to complete isolation. The deduction for time spent in custody on remand shall be set out in the judgment or in the optional penalty writ. Even if the deprivation of liberty was somewhat shorter than the imposed penalty, the penalty may be deemed to have been served in its entirety.
When partially suspended imprisonment is imposed, the deduction for time spent in custody on remand shall be made first from the immediate part of the penalty.
When imprisonment and fines are imposed, the deduction for time spent in custody on remand shall be made first from the sentence of imprisonment.
When preventive detention is imposed, the full deduction for time spent in custody on remand shall be made from both the minimum term and the time frame.
When a fine is imposed, the deduction for time spent in custody on remand shall be made from the alternative sentence of imprisonment, and the fine shall be reduced proportionately.
When a community sentence is imposed, the deduction for time spent in custody shall be made from the alternative sentence of imprisonment, and the number of hours of the community sentence and the execution period shall be reduced proportionately. If a community sentence is imposed together with immediate imprisonment, the deduction shall be made first from the sentence of imprisonment.
When a youth sentence is imposed, the deduction for time spent in custody on remand shall be made from the alternative sentence of imprisonment.
When sentencing is deferred, the judgment shall note whether the person charged has been deprived of liberty on account of the case and, if so, for how long.