delivered the opinion of the court:
On July 30, 1998, the defendant, Jeremiah Pasewaldt, was arrested and charged with predatory criminal sexual assault of a child (see 720 ILCS 5/12 — 14.1(a)(1) (West 2000)) after he attacked an 11-year-old girl in his garage. On June 8, 1999, the defendant appeared in court to enter a guilty plea and receive a recommended eight-year sentence pursuant to an agreement with the State.
The State offered, and the defendant acknowledged, a factual basis for his guilty plea. In admonishing the defendant, the trial judge told the defendant that the sentencing range for his offense, a Class X felony, was 6 to 30 years. See 177 Ill. 2d R. 402(a)(2); 730 ILCS 5/5— 8 — 1(a)(3) (West 2000). The trial judge then asked the State and the defense whether the truth-in-sentencing provisions of the Unified Code of Corrections (see 730 ILCS 5/3 — 6—3(a)(2) (West 2000)) applied. The assistant State’s Attorney did not believe that truth-in-sentencing *555applied to a 1998 offense. The judge stated that, though the provisions were in effect, “the question is whether the offense is covered.” The defendant’s attorney was uncertain, offering, “I need to check that.” The judge continued the defendant’s sentencing hearing to research this issue. On June 21, 1999, the parties again appeared in court. The trial judge addressed the defendant:
“I have determined that truth in sentencing does not apply to this case, so you’ll be entitled to your normal good time credits, et cetera. I also have considered the fact that both the [assistant] State’s Attorney and your lawyer told me that they didn’t contemplate that it applies. That means at the time that they entered into this agreement relative to this sentence, they *** didn’t consider the fact that truth in sentencing might apply. And I have written on your sentencing order that it doesn’t apply.”
At the bottom of the sentencing order, the trial judge noted, “NOT SUBJECT TO TRUTH IN SENTENCING.” The judge sentenced the defendant to eight years’ imprisonment and payment of costs.
On March 1, 2002, nearly three years later, the State filed a motion for leave to file a mandamus complaint (see 188 Ill. 2d R. 381; Ill. Const. 1970, art. VI, § 4(a)) seeking an amended sentencing order without any language to indicate that truth-in-sentencing should not apply. We granted this motion on March 14, 2002.
ANALYSIS
Mandamus is an extraordinary remedy traditionally used to compel a public official to perform a purely ministerial duty. See Lewis E. v. Spagnolo, 186 Ill. 2d 198, 229 (1999); Madden v. Cronson, 114 Ill. 2d 504, 514 (1986). A writ of mandamus will be awarded only if a plaintiff establishes a clear, affirmative right to relief, a clear duty of the public official to act, and a clear authority in the public official to comply with the writ. See People ex rel. Waller v. McKoski, 195 Ill. 2d 393, 398 (2001). The sentencing provisions of the Unified Code of Corrections are mandatory, and a mandamus complaint *556is a proper vehicle to force a trial judge to apply them. See People ex rel. Baker v. Cowlin, 154 Ill. 2d 193, 196 (1992), quoting People ex rel. Daley v. Limperis, 86 Ill. 2d 459, 466 (1981); see also People v. Watford, 294 Ill. App. 3d 462, 464 (1997) (a mandamus complaint is the proper means for a defendant to challenge the application of truth-in-sentencing requirements). The sole issue before us is whether the trial judge’s sentencing order comported with statutory, truth-in-sentencing requirements.
“Truth-in-sentencing” is a label applied to a change in the statutory method the Illinois Department of Corrections uses to calculate good-conduct credit. Under the Unified Code of Corrections, an inmate normally receives day-for-day good-conduct credit. See 730 ILCS 5/3 — 6— 3(a)(2.1) (West 2000). Section 3 — 6—3(a)(2)(ii) of the Unified Code, however, unambiguously mandates that a defendant convicted of an enumerated violent crime, including predatory criminal sexual assault of a child, “shall receive no more than 4.5 days of good conduct credit for each month of his or her sentence of imprisonment.” 730 ILCS 5/3 — 6—3(a)(2)(ii) (West 2000).1 That is, such a defendant must serve at least 85% of his or her sentence and does not receive normal day-for-day good-conduct credit.
Here, the defendant does not dispute this interpreta*557tion of the statute, but he contends that the State is estopped from attempting to modify a sentencing order which comports with the plea agreement. We recognize the important role that plea-bargaining plays in our criminal justice system. See generally Bordenkircher v. Hayes, 434 U.S. 357, 54 L. Ed. 2d 604, 98 S. Ct. 663 (1978); People v. Evans, 174 Ill. 2d 320 (1996); People v. Boyt, 109 Ill. 2d 403, 416 (1985). This case, however, is not about a promise made and broken by the State; it is about a sentence agreed to by the parties, and imposed by the trial court, in violation of a statute.
As the State correctly notes, a sentence which does not conform to a statutory requirement is void and may be corrected at any time. See People v. Arna, 168 Ill. 2d 107, 113 (1995). Here, the trial court had no authority to order, and the State had no authority to agree, that the defendant’s eight-year sentence was not subject to truth-in-sentencing. See People v. Brown, 296 Ill. App. 3d 1041, 1043 (1998) (mandatory supervised release requirements may not be bargained-away by the State during plea negotiations). Accordingly, we award the writ and order the Ogle County circuit court to issue an amended sentencing order without language exempting the defendant from section 3 — 6—3(a)(2)(ii). Because the trial judge who sentenced the defendant has retired, the writ is issued to the court. See People ex rel. Barrett v. Sbarbaro, 386 Ill. 581, 593 (1944).
Application of section 3 — 6—3(a) (ii) to an eight-year sentence results in a prison term of at least 6.8 years. When the defendant agreed to enter a guilty plea, however, he likely contemplated a prison term of four years — eight years less day-for-day good-conduct credit. The defendant does not intimate that he may have gone to trial if faced with an additional 2.8 years’ imprisonment; rather, he offers an alternative to minimize penal consequences of granting mandamus relief. The defen*558dant suggests that we use our supervisory authority to reduce his sentence to the minimum for a Class X felony, six years, with truth-in-sentencing requirements to apply. Assuming he receives the maximum good-conduct credit allowed under section 3 — 6—3(a)(2)(ii), the defendant would serve 5.1 years. The State has no objection to this alternative, and we find it to be an equitable solution because neither party contemplated truth-in-sentencing requirements when negotiating toward a guilty plea. Accordingly, under Supreme Court Rule 615(b)(4) (see 134 Ill. 2d R. 615(b)(4)), we reduce the defendant’s sentence to six years’ imprisonment.
CONCLUSION
The Illinois truth-in-sentencing provisions of the Unified Code of Corrections applied to the offense of which the defendant was convicted, and the trial judge lacked the discretion to order that the defendant was not subject to the provisions. A writ of mandamus is awarded to the State, and the Ogle County circuit court is ordered to issue an amended sentencing order. Further, in the exercise of our supervisory authority pursuant to Supreme Court Rule 615(b)(4), we reduce the defendant’s sentence to six years’ imprisonment.
Writ awarded.