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, Appel-lee 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 *92734 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 “judg*928ment.” 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, 958 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.
*929The distinction between Ybarra and Ap-pellee’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-sen-tence 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-sen-tence 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 statute 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. The following is the discussion related to the acceptance of the plea bargain found in the record:
*927[The Court]: All right. Is there a plea bargain in Number 22398-422?
[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.
. 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).