
778 N.E.2d 701 (2002)
201 Ill.2d 552
268 Ill.Dec. 435
The PEOPLE of the State of Illinois ex rel. James E. RYAN, Petitioner,
v.
John B. ROE et al., Respondents.
No. 93370.
Supreme Court of Illinois.
October 3, 2002.
*702 James E. Ryan, Attorney General, Springfield (Joel D. Bertocchi, Solicitor General, William L. Browers, Jay Paul Hoffmann, Assistant Attorneys General, Chicago, of counsel), for petitioner.
G. Joseph Weller, Deputy Defender, Bruce Kirkham, Assistant Defender, Office of the State Appellate Defender, Elgin, for respondent Jeremiah Pasewaldt.
Justice FITZGERALD 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 truthin-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 applied 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 *703 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, 238 Ill.Dec. 1, 710 N.E.2d 798 (1999); Madden v. Cronson, 114 Ill.2d 504, 514, 103 Ill.Dec. 729, 501 N.E.2d 1267 (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, 254 Ill.Dec. 729, 748 N.E.2d 175 (2001). The sentencing provisions of the Unified Code of Corrections are mandatory, and a mandamus complaint is a proper vehicle to force a trial judge to apply them. See People ex rel. Baker v. Cowlin, 154 Ill.2d 193, 196, 180 Ill.Dec. 738, 607 N.E.2d 1251 (1992), quoting People ex rel. Daley v. Limperis, 86 Ill.2d 459, 466, 56 Ill.Dec. 666, 427 N.E.2d 1212 (1981); see also People v. Watford, 294 Ill.App.3d 462, 464, 228 Ill.Dec. 934, 690 N.E.2d 1009 (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 *704 receive normal day-for-day good-conduct credit.
Here, the defendant does not dispute this interpretation 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, 98 S.Ct. 663, 54 L.Ed.2d 604 (1978); People v. Evans, 174 Ill.2d 320, 220 Ill.Dec. 332, 673 N.E.2d 244 (1996); People v. Boyt, 109 Ill.2d 403, 416, 94 Ill.Dec. 438, 488 N.E.2d 264 (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, 212 Ill.Dec. 963, 658 N.E.2d 445 (1995). Here, the trial court had no authority to order, and the State had no authority to agree, that the defendant's eight-year sentencewas not subject to truth-in-sentencing. See People v. Brown, 296 Ill.App.3d 1041, 1043, 231 Ill.Dec. 255, 695 N.E.2d 1374 (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, 54 N.E.2d 559 (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 dayfor-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 defendant 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.
NOTES
[1]  The General Assembly originally enacted truth-in-sentencing requirements in Public Act 89-404, eff. August 20, 1995, but did not include predatory criminal sexual assault of a child as a triggering offense. We invalidated this act under the single subject clause of the Illinois Constitution. People v. Reedy, 186 Ill.2d 1, 237 Ill.Dec. 74, 708 N.E.2d 1114 (1999). However, before our decision in Reedy, the General Assembly revisited truthin-sentencing. In both Public Act 90-592 and Public Act 90-593, both effective June 19, 1998, the General Assembly reenacted truthin-sentencing provisions and included predatory criminal sexual assault of a child as a triggering offense. The defendant committed his offense on June 30, 1998. He concedes that section 3-6-3(a)(2)(ii) applied to his offense.
