If a defendant who has been imprisoned during the pendency of any posttrial proceeding in any state or federal court shall be again convicted upon a new trial resulting from any such proceeding, the period of his or her former imprisonment shall be deducted by the superior court from the period of imprisonment to be fixed on the last verdict of conviction.
RCW 9.95.063