The number of days spent by a prisoner in incarceration in any municipal or county jail while awaiting trial on a criminal charge, or awaiting an appeal to a higher court upon conviction, shall be applied on any sentence rendered by a court of law or on any sentence finally set after all avenues of appeal are exhausted.
Miss. Code § 99-19-23