Appellant was convicted of a 1995 robbery and sentenced to state prison. A federal court granted his habeas petition and directed that his conviction be vacated. Upon return to the trial court, appellant entered into a negotiated plea disposition and was awarded credit on his new sentence for only the actual days of prior prison custody and referred the matter to CDC for determination of conduct credits. Here, the appellate court concluded that because the conviction was invalidated, appellant had to be placed in the same position as if no trial had been held. Therefore, the time served had to be treated as pre-conviction custody, and measured by the standards of Penal Code section 4019.