
912 N.E.2d 320 (2009)
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Juan C. CASTANO, Defendant-Appellant.
No. 3-07-0845.
Appellate Court of Illinois, Third District.
July 13, 2009.
*321 Santiago A. Durango, Office of State Appellate Defender, Ottawa, IL, for Appellant.
Terry A. Mertel, Deputy Director State's Attorneys Appellate Prosecutor, Ottawa, IL, James Glasgow, State's Attorney, Joliet, IL, Sabrina S. Henry, State's Attorney Appellate Prosecutor, Ottawa, IL, for Appellee.
Justice CARTER delivered the opinion of the court:
The defendant, Juan C. Castano, pled guilty to criminal sexual assault and was sentenced to nine years of imprisonment. 720 ILCS 5/12-13(a)(1) (West 2000). The defendant filed a pro se petition for postconviction relief pursuant to the Post-Conviction Hearing Act (the Act), which the trial court dismissed for failing to state the *322 gist of a constitutional claim. 725 ILCS 5/122-1 et seq. (West 2004). In an unpublished order, this court reversed and remanded the matter for further proceedings under the Act. People v. Castano, No. 3-04-0611 (2006) (unpublished order under Supreme Court Rule 23). On remand, the trial court dismissed the defendant's claim that the court had violated his constitutional rights because it had failed to admonish him at the plea hearing that any sentence received as a result of a conviction for criminal sexual assault was subject to the truth-in-sentencing statute. A claim of ineffective assistance of counsel proceeded to an evidentiary hearing and was denied. On appeal, the defendant claims the court erred by dismissing his claim of improper admonishment. We affirm.

FACTS
On February 21, 2003, the defendant entered a nonnegotiated plea of guilty to criminal sexual assault. The parties agree that the court did not inform the defendant prior to accepting his guilty plea that a sentence imposed upon a conviction of criminal sexual assault was subject to the truth-in-sentencing statute. The sentencing hearing was held that same day and the trial court imposed a nine-year sentence on the defendant. In addition, the court stated, "You must serve 85 percent of this sentence." The defendant did not file any postplea motions, nor did he file a direct appeal.
On May 3, 2004, the defendant filed a pro se postconviction petition. In that petition, the defendant alleged inter alia that his plea was involuntary because his attorney had advised him that his sentence was subject to 50% good-conduct credit. The court denied the petition, finding it frivolous and patently without merit. The defendant appealed.
On appeal, this court reversed the denial of the postconviction petition and remanded the matter for further proceedings under the Act. Two justices agreed that the petition stated the gist of a constitutional claim, though for different reasons. One justice dissented and would have affirmed the denial of the petition.
Upon remand, the trial court appointed counsel for further postconviction proceedings. On June 29, 2007, the defendant filed an amended petition for postconviction relief setting forth two claims of constitutional violation. First, the defendant claimed that the trial court violated his due process rights by failing to admonish him that the truth-in-sentencing statute applied to his sentence. Second, the defendant claimed that he was denied the effective assistance of counsel because trial counsel erroneously informed him that he was not subject to the truth-in-sentencing statute and would receive good-conduct credit at the rate of 50% of his sentence.
The State filed a motion to dismiss the amended petition. The court dismissed the defendant's claim that the court had violated his due process rights by failing to admonish him of the application of the truth-in-sentencing statute to his conviction. The defendant's ineffective assistance of counsel claim proceeded to an evidentiary hearing and was subsequently denied. The defendant appealed.

ANALYSIS
On appeal, the defendant challenges the court's decision to dismiss his claim of a constitutional violation due to the court's failure to admonish him that any sentence he received was subject to truth-in-sentencing. The defendant argues that the truth-in-sentencing provision was a direct consequence of pleading guilty and his plea was not knowing and voluntary because he was not so admonished. *323 Thus, the defendant contends he was denied his right to due process and his guilty plea should be vacated. The State disagrees and maintains that the applicability of the truth-in-sentencing statute was a collateral consequence of the defendant's guilty plea.
A defendant may raise for the first time in a postconviction petition a claim that his plea was involuntary because of insufficient admonishments. People v. Stroud, 208 Ill.2d 398, 403, 281 Ill. Dec. 545, 804 N.E.2d 510, 513 (2004). The Act provides a three-stage process by which criminal defendants may allege substantial violations of their state and federal constitutional rights. People v. Petrenko, 385 Ill.App.3d 479, 481, 324 Ill.Dec. 797, 896 N.E.2d 873, 875 (2008). In this case, the relevant claim was dismissed at the second stage of the proceedings. At the second stage, the trial court must determine "whether defendant's petition and documentation `make a substantial showing of a constitutional violation.'" People v. Stewart, 381 Ill.App.3d 200, 203, 320 Ill.Dec. 317, 887 N.E.2d 461, 464 (2008) quoting People v. Edwards, 197 Ill.2d 239, 246, 258 Ill.Dec. 753, 757 N.E.2d 442, 446 (2001). We review de novo the dismissal of a postconviction petition at the second stage. Stewart, 381 Ill.App.3d at 203, 320 Ill.Dec. 317, 887 N.E.2d at 464.
"If a defendant's guilty plea is not voluntary and knowing, it has been obtained in violation of due process and, therefore, is void." People v. Williams, 188 Ill.2d 365, 370, 242 Ill.Dec. 260, 721 N.E.2d 539, 543 (1999). To knowingly and voluntarily plead guilty, a defendant must be advised of the direct consequences of a guilty plea. Williams, 188 Ill.2d at 371, 242 Ill.Dec. 260, 721 N.E.2d at 543. However, a defendant need not be advised of collateral consequences of a guilty plea. Williams, 188 Ill.2d at 371, 242 Ill.Dec. 260, 721 N.E.2d at 543.
A direct consequence of a guilty plea is a consequence which has a definite, immediate and largely automatic effect on the range of the defendant's sentence. Williams, 188 Ill.2d at 372, 242 Ill.Dec. 260, 721 N.E.2d at 544. "In other words, a trial court's obligation to ensure that a defendant understands the direct consequences of his or her plea encompasses only those consequences of the sentence that the trial judge can impose." Williams, 188 Ill.2d at 372, 242 Ill.Dec. 260, 721 N.E.2d at 544. In contrast, a "`collateral consequence is one that is not related to the length or nature of the sentence imposed on the basis of the plea.'" Williams, 188 Ill.2d at 372, 242 Ill.Dec. 260, 721 N.E.2d at 544 quoting State v. McFadden, 884 P.2d 1303, 1304 (Utah App.1994). Generally, a trial court does not control a collateral consequence of a guilty plea; instead, that consequence results from the action taken by an agency. Williams, 188 Ill.2d at 372, 242 Ill. Dec. 260, 721 N.E.2d at 544.
In the instant case, the defendant claims that the truth-in-sentencing provision of the Unified Code of Corrections (the Code) was a direct consequence of his guilty plea. 730 ILCS 5/3-6-3(a)(2)(ii) (West 2002). Section 3-6-3(a)(1) of the Code directs the Department of Corrections (DOC) to prescribe rules and regulations for the early release of prisoners on account of good conduct. 730 ILCS 5/3-6-3(a)(1) (West 2002). Under section 3-6-3(a)(2)(ii), a prisoner convicted of certain crimes, including criminal sexual assault, "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 2002). Thus, a defendant whose sentence is subject to this *324 statute must serve at least 85% of the sentence imposed.
Contrary to the defendant's assertions, the applicability of section 3-6-3(a)(2)(ii) is not a direct consequence of a guilty plea. People v. Frison, 365 Ill.App.3d 932, 934-35, 303 Ill.Dec. 703, 851 N.E.2d 890, 893-94 (2006); People v. Stewart, 381 Ill. App.3d 200, 204, 320 Ill.Dec. 317, 887 N.E.2d 461, 465 (2008). Unlike statutes requiring higher penalties for subsequent convictions of the same crime (see People v. Warship, 59 Ill.2d 125, 128, 319 N.E.2d 507, 509 (1974)) or requiring mandatory consecutive sentences (see People v. Curry, 178 Ill.2d 509, 528-29, 227 Ill.Dec. 395, 687 N.E.2d 877, 887 (1997)), the statute at issue here does not require a court to impose a certain sentence. Rather, this statute governs the potential good-conduct credit that a prisoner may receive.
Although any amount of good-conduct credit ultimately impacts the amount of time that a prisoner actually spends in prison, the application of the statute does not have a definite, immediate or automatic effect on the sentence imposed. Frison, 365 Ill.App.3d at 934-35, 303 Ill.Dec. 703, 851 N.E.2d at 893-94. The award of credit depends upon a prisoner's good conduct, and though the statute provides that it shall not exceed 4.5 days per month, credit is not guaranteed at any amount. In addition, section 3-6-3(c) of the Code directs the DOC to prescribe rules and regulations regarding the revocation of good-conduct credit and the suspension or reduction of rate of accumulation of credit for specific rule violations during imprisonment. 730 ILCS 5/3-6-3(c) (West 2002). Thus, it is a prisoner's behavior while imprisoned that determines the amount, if any, of good-conduct credit that will be applied to his sentence.
Further, the trial court does not control the manner in which good-conduct credit is earned and lost by a prisoner. Section 3-6-3 directs the DOC, not the trial court, to prescribe the rules for earning and losing good-conduct credit within the statutory limits. 730 ILCS 5/3-6-3 (West 2002). The "DOC ultimately has discretion as to whether defendant will be awarded any credit." Stewart, 381 Ill.App.3d at 204, 320 Ill.Dec. 317, 887 N.E.2d at 465.
The defendant relies heavily upon People ex rel. Ryan v. Roe, 201 Ill.2d 552, 268 Ill.Dec. 435, 778 N.E.2d 701 (2002), to support his argument that the application of the truth-in-sentencing statute to his sentence is a direct consequence of his guilty plea. In Roe, the attorneys and the trial court incorrectly concluded that the truth-in-sentencing statute did not apply to the defendant's sentence. The trial court wrote at the bottom of the sentencing order, "`NOT SUBJECT TO TRUTH IN SENTENCING.'" Roe, 201 Ill.2d at 555, 268 Ill.Dec. 435, 778 N.E.2d at 703. Three years later, the State filed a motion for leave to file a mandamus complaint seeking an amended sentencing order striking this language. The Illinois Supreme Court awarded the writ and ordered the trial court to issue an amended sentencing order because "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." Roe, 201 Ill.2d at 557, 268 Ill. Dec. 435, 778 N.E.2d at 704. Roe does not involve any consideration of whether section 3-6-3(a)(2) of the Code is a collateral consequence of a guilty plea. Thus, we do not find Roe helpful to our determination of the issue presented in the instant matter.

CONCLUSION
Based upon the above analysis, we find that the application of section 3-6-3(a)(2)(ii) to the defendant's sentence was *325 a collateral consequence of his guilty plea, and the trial court did not err by failing to admonish him at his plea hearing of the statute's application. Thus, the court did not err by dismissing this claim of the defendant's postconviction petition at the second stage of postconviction proceedings. Accordingly, the judgment of the Will County circuit court is affirmed.
Affirmed.
O'BRIEN, P.J. and SCHMIDT, J. concurring.
