Appealing from the issuance of a writ of habeas corpus, Edward C. Morris, Warden of Mecklenburg Correctional Center, challenges the good-time credit the trial court awarded Leroy Smith, Jr.
On November 18, 1976, Smith was convicted of possession of an illegal weapon and unlawful wounding, offenses committed while he was a prisoner, and a total of three years was added to the sentence he was serving. At that time, Code § 53-213, which authorized “good-time” credit against a sentence for time served “without violating any written jail or prison rule or regulation,” contained the following exception:
[N]o prisoner who is convicted of a felony committed . . . while confined . . . shall be eligible for any such credit upon any term of confinement received as a result of conviction of such felony.
The General Assembly amended the statute and repealed this exception effective July 1, 1977. Acts 1977, c. 182. As grounds for habeas, Smith contended that he was entitled to credit for good-time served after the repeal, and the parties stipulated that, if so entitled, Smith was “eligible for immediate release from custody.” *7Finding that “prohibition of good time credit was not part of the Court’s sentence of November 18, 1976,” the trial judge upheld Smith’s contention. By order entered February 19, 1981, he issued the writ and ordered that, pending appeal, Smith be released upon a $1000 bond, without security, and upon his own recognizance.
Smith correctly notes that a prisoner earns each discrete award of good-time credit only as he serves the twenty days of his sentence upon which that single good-time credit is computed. Therefore, he concludes, the Department of Corrections must award him credit under the statute as it exists at the time he is serving his sentence rather than the statute extant at the time the sentence was imposed.
We disagree. The trial court erred in finding that Smith’s sentence did not prohibit good-time credit. The crimes of which he was convicted and the terms and conditions of the attendant penalties were defined by the statutes in effect when sentence was pronounced. Part of the penalty prescribed by the General Assembly for crimes committed by a prisoner during his confinement was forfeiture of his inchoate right to earn good-time credit. At the moment judgment was entered, the statutory forfeiture attached by operation of law. Had the judgment order contained an express prohibition against good-time credit, it would have been mere surplusage.
Code § 1-16 provides that
No new law shall be construed to repeal a former law, as to any offense committed against the former law, or as to . . . any penalty, forfeiture, or punishment incurred . . . under the former law, or in any way whatever to affect any such offense ... or any penalty, forfeiture, or punishment so incurred . . . and if any penalty, forfeiture, or punishment be mitigated by any provision of the new law, such provision may ... be applied to any judgment pronounced after the new law takes effect.
Applying Code § 1-16, we hold that the 1977 amendment to Code § 52-213 was applicable only to a penalty, forfeiture, or punishment imposed by “judgment pronounced after the new law [took] effect” and that it did not “in any way whatever” affect the forfeiture incurred by Smith on account of the judgment pronounced in 1976.
*8We will reverse the judgment, vacate the writ, and remand the case with instructions to restore Smith to custody to serve the remainder of his sentence.
Reversed and remanded.