(a) The custodian of the defendant shall be required to make an affidavit specifying the number of days which the defendant has spent in confinement in his custody and furnish the affidavit to the clerk of the court within five days after sentence is imposed if the defendant is convicted. The affidavit of the custodian of the defendant shall be made a part of the official record of the trial.(b) The clerk of the court shall transmit a copy of the custodian’s affidavit to the Department of Corrections when the defendant has been sentenced to the custody of the department. The Department of Corrections shall give the defendant credit for the number of days spent in confinement prior to conviction and sentence, as reflected in the custodian’s affidavit, before forwarding the record to the State Board of Pardons and Paroles.(c) Where the defendant has been sentenced to the custody of an official other than the commissioner of corrections, the clerk of the court shall transmit the custodian’s affidavit to the proper authorities who shall give the defendant credit for the number of days spent in custody prior to conviction and sentence.(d) For service under this Code section, the clerk shall receive the fee prescribed in Code Section 15-6-77 from the funds of the county, except where the clerk is on a salary.