
119 Ill.2d 24 (1987)
518 N.E.2d 136
THE PEOPLE OF THE STATE OF ILLINOIS, Appellant,
v.
FRED M. WILLIAMS, Appellee.
No. 63679.
Supreme Court of Illinois.
Opinion filed December 30, 1987.
Neil F. Hartigan, Attorney General, of Springfield, and William Herzog, State's Attorney, of Kankakee (Kenneth R. Boyle, John X. Breslin and Howard R. Wertz, of the State's Attorneys Appellate Prosecutor, of Ottawa, of counsel, and Lissa L. Rademaker, law student), for the People.
Robert Agostinelli, Deputy Defender, and Nancy Rink Carter, Assistant Defender, of the Office of the State *25 Appellate Defender, of Ottawa, for appellee.
Judgment affirmed.
JUSTICE SIMON delivered the opinion of the court:
Defendant, Fred M. Williams, was sentenced to a 30-month term of probation on April 7, 1983, after pleading guilty to retail theft in the circuit court of Kankakee County. On July 15, 1985, with less than three months remaining on his sentence, the State filed a petition to revoke probation, alleging that the defendant had pleaded guilty to possession of cannabis and theft. A summons was issued two days later.
At a hearing on March 6, 1986, the circuit judge dismissed the revocation petition on the ground that it did not allege the defendant had committed a criminal act, but only that he had pleaded guilty to one. The defendant then submitted that his probation should be declared expired. Three weeks later the judge ruled that section 5-6-4(a)(3) of the Unified Code of Corrections (Ill. Rev. Stat. 1985, ch. 38, par. 1005-6-4(a)(3)) barred any credit for time served by the defendant on probation during the pendency of the revocation petition even though the petition was eventually dismissed. The circuit judge stated that the statute was "completely unfair" and declared the clause he interpreted as barring the credit unconstitutional. The State appealed directly to this court because the statute had been invalidated. (See 107 Ill.2d Rules 302, 603.) Defendant moved to dismiss the appeal, and we took the motion with the case.
It should be emphasized that the State did not appeal from the circuit judge's initial order dismissing the revocation petition, and the propriety of that order is not before us. Rather, the question presented concerns the meaning and validity of section 5-6-4(a)(3) of the Unified Code of Corrections.
Section 5-6-4(a)(3) provides in relevant part:

*26 "Personal service of the petition for violation of probation or the issuance of [a] warrant, summons or notice shall toll the period of probation * * * until the final determination of the charge, and the term of probation * * * shall not run until the hearing and disposition of the petition for violation." (Ill. Rev. Stat. 1985, ch. 38, par. 1005-6-4(a)(3).)
Absent this statute, revocation of the defendant's probation would have been impossible since his sentence would have expired prior to the hearing on the petition. But the circuit judge believed that the statute also precluded him from crediting against the defendant's sentence time served on probation during the pendency of the revocation petition.
The circuit judge's conclusion that the "tolled" period does not count toward the defendant's sentence cannot be squared with this court's decision in People v. Goodman (1984), 102 Ill.2d 18. There the court held that "the purpose of the tolling provision is simply to ensure that jurisdiction over the probationer is retained and that the period of probation does not expire prior to a hearing upon the petition to revoke. [Citations.] It was not intended, in our judgment, to preclude credit for the interval between service upon defendant of a copy of the revocation petition, summons or warrant and sentencing, unless the trial court directs otherwise." 102 Ill.2d 18, 21-22.
Goodman, it is true, involved a probationer whose probation was actually revoked, and another subdivision of the statute provides that time served on probation is to be credited against a sentence of imprisonment following revocation unless the court orders otherwise (Ill. Rev. Stat. 1985, ch. 38, par. 1005-6-4(h)). But this distinction does not detract from the authority of Goodman here. Clearly essential to that decision was the court's finding that the period following the issuance of a summons *27 or warrant on a petition for revocation is in fact time served on probation. The court there observed: "It would not seem sensible to impute to the General Assembly, because of the tolling provision, an intent to free a defendant from his duty to comply with the conditions of probation because a petition to revoke his probation has been filed." (People v. Goodman (1984), 102 Ill.2d 18, 21.) Since it would have been anomalous to find probation tolled for purposes of giving credit while requiring him to continue complying with the conditions of probation, this court in Goodman required that credit be given.
The anomaly would be even greater here since the revocation petition against the defendant was dismissed, and the defendant's probation was not revoked. Indeed, the Goodman opinion offered the example of a probationer found not to have violated his probation to demonstrate the injustice of not permitting credit for time served after filing of a revocation petition. The State attempts to distinguish the situation hypothesized in Goodman from that existing here because this defendant is not "innocent" and the petition was dismissed on merely technical grounds. The State, however, never took any action challenging the dismissal, and for purposes of this appeal the only relevant consideration is that defendant's probation was not revoked.
It would be absurd to limit credit for time served after issuance of summons to appear at a revocation hearing to those whose probation is eventually revoked while refusing such credit to probationers whose probation is not revoked. Besides, to so construe the statute would raise a substantial question as to its constitutionality. No justification has been offered for treating more harshly with respect to time credit those who have committed no violation than those who have, and such a classification might well be considered arbitrary. (See People v. Wagner *28 (1982), 89 Ill.2d 308.) Nor does there appear to be any "legitimate legislative purpose" (People v. Kohrig (1986), 113 Ill.2d 384, 400) supporting the denial of credit in this situation. We are obliged to construe statutes both to avoid absurd or unjust consequences and to affirm their constitutionality (People v. Inghram (1987), 118 Ill.2d 140; Harris v. Manor Healthcare Corp. (1986), 111 Ill.2d 350, 363), and to read the statute as prohibiting a credit here would flout both principles.
Subdivision (h) of section 5-6-4 (Ill. Rev. Stat. 1985, ch. 38, par. 1005-6-4(h)) grants a presumptive credit against a sentence of imprisonment for time served after a summons for revocation is issued. We believe that, by implication, when probation is not revoked, the defendant is automatically entitled to credit. Defendant here had less than three months remaining on his probation when he was summoned to appear at the revocation hearing, and the petition was not disposed of until more than seven months later. Since his probation was not revoked, defendant is entitled to credit for the time following the issuance of summons, and his sentence has therefore been completed.
Our reading of the statute avoids the constitutional difficulty perceived by the circuit judge. We affirm his judgment that the defendant's probation has expired, but not for the reason he cited. Our disposition of the case makes it unnecessary to pass upon the other issues raised by the defendant.
Judgment affirmed.
JUSTICE CUNNINGHAM took no part in the consideration or decision of this case.
