
240 S.W.3d 925 (2007)
Jeremy Paul COLLINS, Appellee
v.
The STATE of Texas.
No. PD-1203-06.
Court of Criminal Appeals of Texas.
November 21, 2007.
*926 James P. Pruitt, Rockwall, for Appellant.
J. Landon K. Schmidt, Assistant District Atty., Kaufman, Jeffrey L. Van Horn, State's Atty., Austin, for State.

OPINION
MEYERS, J., delivered the opinion of the Court, in which KELLER, P.J., and PRICE, WOMACK, JOHNSON, KEASLER, HERVEY, and COCHRAN, JJ., joined.
Appellee, Jeremy Paul Collins, pleaded guilty to possession of more than four, but less than two hundred, grams of methamphetamine, a second-degree felony. TEX. HEALTH & SAFETY CODE ANN. § 481.115(d). Pursuant to a plea agreement accepted by the court, Appellee was sentenced to five years' confinement with 34 days of pre-sentence jail-time ("back-time"). He did not file a motion for new trial or appeal from his conviction. Appellee filed an application for writ of habeas corpus or motion for judgment nunc pro tunc. The trial court rendered judgment nunc pro tunc granting Appellee an additional 271 days of back-time credit. The State appealed the judgment nunc pro tunc, and the court of appeals vacated the trial court's judgment nunc pro tunc and reinstated the original judgment. State v. Collins, No. 05-05-01057-CR, 2006 WL 924999, 2006 Tex.App. LEXIS 2886 (Tex.App.-Dallas April 11, 2006) (mem. op., not designated for publication). We granted Appellee's petition for discretionary review to determine whether the court of appeals had jurisdiction over the state's appeal and whether it was proper for a trial court to award back-time credit by judgment nunc pro tunc. We affirm the decision of the court of appeals.

FACTS
On September 11, 2003, Appellee was pulled over for not having a license-plate lamp. During this traffic stop, it was also discovered that Appellee had no liability insurance. Appellee gave the detaining police officer consent to search the vehicle and the officer found an unlicensed .45 caliber handgun. Appellee was arrested and asked if he had any other illegal items on him, which he denied. Appellee was transported to the Kaufman County Law Enforcement Center, where he underwent a routine strip search. While removing his clothing, a small package containing what was later determined to be crystal methamphetamine fell out of his underwear. The State obtained an indictment charging Appellee with both possession of methamphetamine and possession of a controlled substance in a correctional facility.
In exchange for a guilty plea to the possession of a controlled substance charge, Appellee agreed to a sentence of 5 years confinement, a fine of $4,000, payment of restitution in the amount of $140, and time credit of 34 days. Prior to the acceptance of the plea by the court, Appellee was informed of the conditions of the plea bargain. Appellee acknowledged that he knew his rights and that the conditions read aloud in court conformed to his understanding of the plea agreement.[1] The *927 34 days of back-time were specifically included in the State's recommendation to the judge, and the judge also reiterated the 34 days of back-time when he pronounced sentence. In addition to the oral pronouncement of sentence, the 34 days of back-time are contained in the Agreed Plea Recommendations and Admonishments signed by Appellee.
Appellee did not file a motion for new trial or appeal his conviction. Appellee filed an Application for Writ of Habeas Corpus or Motion for Judgment Nunc Pro Tunc after the plenary power of the trial court had already expired.[2] The trial court held a hearing, rendered Judgment Nunc Pro Tunc, and granted Appellee 271 additional days of back-time that he accrued while in custody in Louisiana under a detainer placed upon him by Kaufman County. The State appealed the judgment nunc pro tunc.
Citing Smith v. State, 15 S.W.3d 294 (Tex.App.-Dallas 2000, no pet.), the State argued that the district court did not have jurisdiction to render judgment nunc pro tunc to award Appellee additional back-time because there was no clerical error. The court of appeals determined that it had jurisdiction to hear the State's appeal because the State could appeal an order that reduced the defendant's sentence and was signed after the trial court's plenary power had expired. It also held that the trial court did not have jurisdiction to render judgment nunc pro tunc to modify a judgment because there was a plea bargain between the parties. Thus, there was no "clerical error" in the original judgment. The Court of Appeals vacated the trial court's modified judgment, and reinstated the original judgment.
Appellee filed a petition for discretionary review asking us to consider whether the Court of Appeals had jurisdiction to hear the State's appeal of the judgment nunc pro tunc; and if a trial court may correct a judgment as to back-time credit by a judgment nunc pro tunc.

DISCUSSION
Jurisdiction of the court of appeals
We agree that the Court of Appeals did have jurisdiction to hear the State's appeal in this case. The State may appeal an order of the trial court if the "order modifies the judgment." TEX.CRIM. PROC.CODE ANN. art. 44.01(a)(2). Appellee unduly emphasizes that the judgment nunc pro tunc did not alter Appellee's "sentence." We held in State v. Gutierrez, 129 S.W.3d 113 (Tex.Crim.App.2004), that the State may appeal an order that reduces a defendant's sentence, but the language of the statute is clear that the State may appeal any order that modifies a "judgment." *928 The sentence is an integral portion of the judgment, but it is just a portion. Article 42.01, § 1(18), of the Texas Code of Criminal Procedure includes "credit for time served" as an element of the judgment. In addition, we stated in State v. Ross, 953 S.W.2d 748 (Tex.Crim. App.1997), that "a sentence is nothing more than the portion of the judgment setting out the terms of the punishment." Id. at 759. Therefore, an order that modifies the amount of back-time received by a defendant via an improperly granted judgment nunc pro tunc may be appealed by the State.
The award of back-time by judgment nunc pro tunc
A judgment nunc pro tunc is the appropriate avenue to make a correction when the court's records do not mirror the judgment that was actually rendered. Alvarez v. State, 605 S.W.2d 615, 617 (Tex. Crim.App.1980). This means that a trial court can fix a clerical error in the record, but only errors that were not the result of judicial reasoning are considered clerical errors that can be fixed by a nunc pro tunc order. Ex parte Poe, 751 S.W.2d 873, 876 (Tex.Crim.App.1988). The trial court cannot, through a judgment nunc pro tunc, change a court's records to reflect what it believes should have been done. Ex parte Dopps, 723 S.W.2d 669, 671 (Tex.Crim. App.1986) (citing Chaney v. State, 494 S.W.2d 813, 814 n. 1 (Tex.Crim.App.1973); Villarreal v. State, 590 S.W.2d 938, 939 (Tex.Crim.App.1979)). "Thus, before a judgment nunc pro tunc may be entered, there must be proof that the proposed judgment was actually rendered or pronounced at an earlier time." Wilson v. State, 677 S.W.2d 518, 521 (Tex.Crim.App. 1984). It is clear from the record of the trial court that there was no clerical error that this judgment nunc pro tunc was correcting. The written judgment perfectly matches the judgment pronounced in court. The judge exercised judicial reasoning when he chose to accept the recommendation of the State and allow the terms of the plea bargain to control, and he entered judgment in accordance with these terms. Therefore, a judgment nunc pro tunc is not the proper remedy for the failure to award additional back-time in this circumstance.
Appellee refers to one court of appeals that said a failure to credit a defendant with pre-sentence jail-time spent in another jurisdiction is a violation of a ministerial duty. See In re Daisy, 156 S.W.3d 922 (Tex.App.-Dallas, 2005). In light of the facts of this case, we disagree. In State ex rel. Hill v. Court of Appeals for the Fifth District, 34 S.W.3d 924, 927 (Tex. Crim.App.2001), we said that an act is not ministerial if a judge must exercise discretion or resolve conflicting legal claims. We also explained that in order for an act to be considered ministerial, the one making the request must have a clear legal right that is so obviously spelled out that the judge would not have any discretion about whether or not to perform the duty. Id. at 927-928.
In Ex parte Ybarra, 149 S.W.3d 147 (Tex.Crim.App.2004), we held that the judge's failure to award all of the defendant's pre-sentence jail-time when he pronounced sentence could be corrected by a judgment nunc pro tunc. In Ybarra, there was no plea bargain in place, and therefore he was entitled to the amount of back-time that the statute provided. An incorrect calculation of the amount of back-time awarded to a defendant, or the omission of any statutory back-time in the judgment can be adjusted by a motion for judgment nunc pro tunc; however, that is not what occurred in this case.
*929 The distinction between Ybarra and Appellee's situation is that, in this case, there is a controlling plea bargain. Code of Criminal Procedure Article 1.14(a) says that a "defendant in a criminal prosecution for any offense may waive any rights secured him by law except that a defendant in a capital felony case may waive the right of trial by jury only in the manner permitted by Article 1.13(b) of this code." (emphasis added.) In Ex parte Olivares, 202 S.W.3d 771 (Tex.Crim.App.2006), we held that a defendant may affirmatively waive his right to pre-sentence jail-time credit by entering into a plea bargain with the state, if the facts on record support that a waiver occurred. The question before this court now is not whether Appellee affirmatively waived his rights to the back-time credit, nor is there even an assertion that the plea bargain was not entered into knowingly and voluntarily. An appeal from a judgment nunc pro tunc would not be the correct procedure for deciding such an issue. However, the ability of a defendant to enter into a plea bargain and waive his right to back-time is important because it demonstrates that Appellee did not have a clear automatic legal right to the pre-sentence credit. As explained above, the act of accepting the recommendation of the State in a plea bargain required the judge to exercise judicial discretion, and when granting the judgment nunc pro tunc, the judge employed judicial reasoning when determining whether he was bound by the terms of the plea bargain. This was not simply a miscalculation in the number of days of back-time to be awarded, or a mistake in the transcription of the judgment into the court records. Each judge had to make specific determinations as to what Appellee was entitled, and therefore, no ministerial act was implicated.
Appellee further argues that if we affirm the decision of the court of appeals, then there will be an added burden and delay in the plea-bargaining process, resulting from defendants being required to get their documents from other jurisdictions before a plea may be entered or the trial judge can sign the judgment. This argument is unconvincing. While efficiency of the court is certainly a concern, Appellee fails to recognize that a defendant could simply negotiate to receive full statutory pre-sentence jail-time credit as an element of the plea bargain. (See Ex parte Jasper, 538 S.W.2d 782 (Tex.Crim. App.1976), awarding additional pre-sentence jail-time credit calculated in accordance with Article 42.03, § 2, of the Texas Code of Criminal Procedure as a result of a plea bargain.) As we mentioned above, when Appellant accepted the plea, there was no mention of the possibility of additional back-time credit. If Appellant had negotiated to receive this, then entry of the final calculation of back-time could have been accomplished by judgment nunc pro tunc. Furthermore, if the amount of pre-sentence jail-time was not a negotiated term of a plea bargain, the estatute would apply and the defendant would be entitled to all statutory back-time. By accepting the plea bargain with 34 days of credit, Appellee waived his statutory right to the time served in another jurisdiction.

CONCLUSION
The Court of Appeals properly determined that it had jurisdiction to hear the state's appeal and that the trial court did not have authority to modify Appellee's judgment. Appellee waived his right to statutory back-time when he entered into the plea bargain with the State. The judgment of the Court of Appeals is affirmed.
HOLCOMB, J., filed a dissenting opinion
*930 HOLCOMB, J., filed a dissenting opinion.
I respectfully dissent from the majority's holding that appellee waived his statutory right to back-time (pre-sentence jail-time) credit when he plea bargained with the State. It is undisputed that appellee was entitled to this credit under the Texas Code of Criminal Procedure, article 42.03, section 2(a)(1). The State's only argument is that when appellee bargained for a specific time-credit of 34 days in the plea agreement, he waived the additional back-time credit of 271 days to which he was also statutorily entitled. The State cites Ex parte Olivares, 202 S.W.3d 771, 773 (Tex.Crim.App.2006), for the proposition that a defendant, in a plea-bargain case, may "affirmatively waive his right to pre-sentencing jail-time credit as a condition of his plea agreement." State's Br. at 9. In Olivares, however, appellee had expressly waived his right to such credit.[1] In contrast, the record in the present case is silent about the additional credit. The State also argues that appellee, in the "Agreed Plea Recommendation and Admonishments," had waived "any and all rights" secured to him by law. But the cited portion of the record consists of a generic, "boiler-plate" list of recommendations, stipulation, waivers, etc., without specifically mentioning any waiver of back-time credit. I believe that appellee, like Olivares, must specifically waive such credit in the plea agreement before he can be denied that statutorily mandated right.
The majority's conclusion is based on the presumption that appellee had a plea agreement that he would receive only 34 days' credit for pre-trial confinement, even if he was legally entitled to receive more. This was a rebuttable presumption, however, created only by the fact that appellee had signed an agreement that he would receive 34 days of credit.[2] But appellee subsequently filed a motion for nunc pro tunc informing the trial court that he had been confined in Louisiana for 271 days, with a detainer lodged by the State of Texas for the present offense, and asked the trial court to take the credit for that confinement into consideration.[3] At that *931 point, the question of the precise number of days which appellee was legally entitled to receive as back-time credit became a question of fact that the trial court resolved in appellee's favor, indicating that it did not consider the back-time credit to be a part of the plea agreement. It is important to note that the trial court did not make any findings of fact. In the absence of such findings, we must "view the evidence in the light most favorable to the trial court's ruling" and sustain its decision if it is "correct on any theory of law applicable to the case." State v. Ross, 32 S.W.3d 853, 855-56 (Tex.Crim.App.2000). We must, therefore, defer to the trial court's implicit finding in this case that appellee had not waived the additional back-time credit to which he was statutorily entitled.
Finally, I would like to point out that in Ex parte Ybarra, 149 S.W.3d 147, 148 (Tex.Crim.App.2004), we held that if the court fails to grant the defendant pre-sentence jail-time credit at the time of sentencing, it "has the authority to correct the judgment to reflect the appropriate time credit by nunc pro tunc order and should do so." Id. at 148. See also Tex. R.App. P. Rule 23.2 (allowing the trial court to use nunc pro tunc proceedings to give the defendant statutorily mandated back-time credit). We also noted our prior holding that "matters which may be raised and resolved by nunc pro tunc proceedings should not be considered by way of writ of habeas corpus." Ybarra, 149 S.W.3d at 148. In short, our holding in Ybarra indicates that any failure to award back-time credit can and should be corrected by nunc pro tunc proceedings.
The majority attempts to distinguish Ybarra from the present case by noting that there was no plea bargain involved in that case. See ante, op. at 928. As I pointed out earlier, however, the record does not indicate that the back-time credit was a part of the plea agreement in the present case either. Moreover, the trial court's action granting appellee the requested additional credit confirms this assumption. As such, Ybarra controls this case and, under Ybarra, the trial court correctly used the nunc pro tunc proceedings to grant appellee the total number of back-time credit to which he was legally entitled.
In light of all the above considerations, I respectfully dissent.
NOTES
[1]  The following is the discussion related to the acceptance of the plea bargain found in the record:

[The Court]: All right. Is there a plea bargain in Number XXXXX-XXX?
[The State]: Yes, Your honor. In exchange for a plea of guilty, the State recommends five years confinement in the Texas Department of Criminal Justice Institutional Division, a $4,000 fine, court costs in the amount of $221.25, restitution to the Texas Department of Public Safety in the amount of $140 with the Defendant to receive credit to his sentence in the time period of 34 days.
[The Court]: All right. Mr. Collins, is that your understanding of the plea bargain?
[The Defendant]: Yes, sir.
[The Court]: And Mr. Pruitt, is that your understanding?
[Defense Counsel]: It is, Judge.
[The Court]: Do you persist, Mr. Collins, in entering your plea?
[The Defendant]: Yes, sir.
[2]  We have suggested in past cases that a trial court has plenary power to modify or rescind its order if a motion for a new trial or a motion in arrest of judgment is filed within 30 days of sentencing. Swearingen v. State, 189 S.W.3d 779, 781 (Tex.Crim.App.2006); State v. Aguilera, 165 S.W.3d 695, 697-98 (Tex. Crim.App.2005).
[1]  See Olivares, 202 S.W.3d at 772-72:

PROSECUTOR: To Count Two and Three we're asking that he be confined for a period of two years in the Institutional Division of the Texas Department of Criminal Justice. And that Count One be considered unadjudicated in Count Two. And that he not be credited any time served in the Hidalgo County Jail.
THE COURT: Enoch [sic] Garza Olivares, is this your understanding of the plea bargain? Counts Two and Three are two years to serve with no credit for time spent in jail. Count One 
THE INTERPRETER: No credit?
THE COURT: No credit, zero credit. And Count One is unadjudicated into Count Two.
THE DEFENDANT: Yes.
THE COURT: This is your plea bargain? You're asking me to accept and approve it? And you understand everything therein contained?
THE DEFENDANT: Yes.
THE COURT: Counselor, is this the totality of the plea bargain?
DEFENSE COUNSEL: Yes, it is, Your Honor.
Thus, the "trial judge found that `[t]he transcript of the plea hearing in [the] case below show[ed] that Applicant expressly and affirmatively waived the right to presentencing jail time credits as a condition of his plea agreement,'" id. at 773, and we agreed with the trial judge's recommendation that Olivares was not entitled to relief. Id.
[2]  Presumably, these 34 days constituted the time appellee had served in Kaufman County, Texas, after he was extradited here from Louisiana.
[3]  The State does not contest the fact that a detainer was filed, nor that appellee had served 271 days in Louisiana after the detainer was filed until he was extradited to Texas.
