
116 Cal.App.3d 798 (1981)
172 Cal. Rptr. 284
THE PEOPLE, Plaintiff and Respondent,
v.
ANDREW PENA VALENZUELA, Defendant and Appellant.
Docket No. 4357.
Court of Appeals of California, Fifth District.
March 11, 1981.
*801 COUNSEL
Stephen J. Ringhoff, under appointment by the Court of Appeal, for Defendant and Appellant.
George Deukmejian, Attorney General, Robert H. Philibosian, Chief Assistant Attorney General, Arnold O. Overoye, Assistant Attorney General, Vincent J. Scally and Garrett Beaumont, Deputy Attorneys General, for Plaintiff and Respondent.
OPINION
STONE (W.A.), J.[*]
Appellant was charged with a violation of sections 488 and 666 of the Penal Code, petty theft with two prior convictions. He was alleged to have stolen a coat from Gottschalk's Department Store in Merced on December 4, 1978. Trial proceeded by the court, a jury having been waived. Appellant was convicted of stealing the coat, and the court further found that appellant had served time in custody following two prior petty theft convictions, pursuant to Penal Code section 666. Appellant was sentenced to a probationary term of 24 months, with a condition that he serve 10 months in custody, with credit for 1 day of time served. Appellant does not challenge the instant petty theft conviction and no further discussion of facts surrounding that incident is necessary here.
The contentions raised concern the use by the trial court of prior petty theft convictions incurred by appellant in 1973 and 1975. He urges that neither falls within Penal Code section 666. We discuss appellant's particular arguments as follows:


*802 I

(1a) DOES AN EARLIER SENTENCE FOR PETTY THEFT, IN WHICH THE ONLY TIME IN CUSTODY ORDERED WAS CREDIT FOR TIME SERVED, COME WITHIN PENAL CODE SECTION 666? YES.
Penal Code section 666 provides: "Every person who, having been convicted of petit theft, grand theft, burglary, or robbery and having served a term therefor in any penal institution or having been imprisoned therein as a condition of probation for such offense, is subsequently convicted of petit theft, then the person convicted of such subsequent offense is punishable by imprisonment in the county jail not exceeding one year, or in the state prison."
On December 19, 1975, appellant entered a plea of guilty to the misdemeanor charge of petty theft (Pen. Code, § 488), and was granted probation for one year, on the condition that he serve sixty days in custody, that all but seven days be suspended, and that appellant receive credit for time served. Although the record is not clear, we assume that the seven days in custody had been served at the time the plea of guilty was made and the sentence imposed.
Appellant suffered another prior conviction in 1973 which followed a jury verdict of guilty on a petty theft charge. On April 3 of that year, following the recommendation of the probation officer, criminal proceedings were suspended and appellant was certified to the superior court pursuant to section 3050 of the Welfare and Institutions Code. After appropriate proceedings in the superior court, appellant was ordered committed to the Department of Corrections for confinement in the California Rehabilitation Center, upon a finding that he was addicted, or in imminent danger of becoming addicted, to narcotics. Following completion of the civil addict commitment, appellant was remanded back to the trial court for further proceedings. On April 2, 1976, he was ordered to serve 10 days in jail with credit for time served pursuant to former Penal Code section 2900.6.[1]
*803 Appellant argues that because former section 2900.6 compelled the sentencing judge in each prior instance to allow credit for time served, such a term of custody was not intended by the Legislature to be a term in a penal institution or imprisonment as a condition of probation, as defined by section 666. He contends that because the sentencing court has no choice but to allow a defendant credit for time served, such time served for presentence custody does not come within the purview of the section. Appellant has referred us to no authority for his claim, nor have we discovered any. Section 2900.6 existed at the time section 666 was enacted in 1976. The Legislature did not choose to except custody resulting from credit for time served from the effect of section 666. We believe that no such exclusion was intended. (2) "The Legislature is presumed to know the existing law and have in mind its previous enactments when legislating on a particular subject." (Rosenthal v. Cory (1977) 69 Cal. App.3d 950, 953 [138 Cal. Rptr. 442].)
(1b) A county jail is a penal institution. (People v. James (1957) 155 Cal. App.2d 604, 612 [318 P.2d 175].) Each jail commitment was a condition of appellant's probation. We think it inconsequential whether the time in custody was served before or after sentencing. In either instance, imprisonment has been in a penal institution within the meaning of section 666.[2]

II

(3) IS THE CALIFORNIA REHABILITATION CENTER A PENAL INSTITUTION WITHIN PENAL CODE SECTION 666? YES.
Appellant next contends that his referral in 1973 to the California Rehabilitation Center (CRC) was not an imprisonment in a penal institution *804 as defined in section 666. As noted earlier, upon conviction of petty theft, the trial court suspended proceedings and certified appellant to the superior court to determine eligibility under Welfare and Institutions Code section 3050 et seq. Appellant testified he was committed to CRC in April 1973 and released from CRC parole status in 1976.
There appears to be no authority responsive to the precise question posed by appellant. However, we hold that CRC is a "penal institution" within the meaning of Penal Code section 666, and that a person who has undergone a commitment to such an institution has "served a term" in a penal institution.
We begin by analyzing the provisions established by the Legislature for confining persons who are addicted to narcotics or, by reason of repeated use, are in danger of becoming addicted.
Welfare and Institutions Code section 3000 provides that treatment is to be nonpunitive, but is to be conducted for the protection of the public.[3] In addition, committed persons who become uncooperative with treatment efforts are to be kept in the program for purposes of control. The responsibility for treating the addict is given by Welfare and Institutions Code section 3001 to the Department of Corrections. That department is directed to receive, control, confine, employ, educate, treat and rehabilitate the addict.[4] While the treatment is to be nonpunitive, the department has the responsibility of controlling and confining *805 persons committed. Escape from a rehabilitation facility is treated as a crime in section 3002.[5]
Similarly, Welfare and Institutions Code section 3305 provides for the custody of persons confined at CRC.[6] Such persons are to be treated in the same manner as prisoners in the state prison system for all purposes described in part 3 of the Penal Code. Part 3 establishes the prisons, provides for their administration, regulates treatment of inmates, establishes the length of terms and allows certain time credits, defines offenses committed by inmates and establishes the system of parole.
Notwithstanding the nonpunitive nature of rehabilitation commitment, our holding  that it constitutes a commitment to a penal institution  is not novel. The Supreme Court has recognized that confinement in a narcotics rehabilitation facility has two purposes, treatment of the addict and protection of the public. "... the legislation was designed not only to treat them for addiction but to protect the public by the policies, program and parole provisions of the narcotic addicts act." (People v. Navarro (1972) 7 Cal.3d 248, 281 [102 Cal. Rptr. 137, 497 P.2d 481].)
Our courts have also recognized that, despite the civil nature of a commitment, it is punitive in that it involves deprivation of personal liberties entitling one so confined to the procedural safeguards of a criminal defendant. (People v. Thomas (1977) 19 Cal.3d 630, 637-641 [139 Cal. Rptr. 594, 566 P.2d 228].)
"Although the commitment procedures set up by the narcotic addict statutes are civil in nature (In re De La O, 59 Cal.2d 128, 156 [28 Cal. Rptr. 489, 378 P.2d 793, 98 A.L.R.2d 705]), it is clear that the proceeding has some of the features pertinent to a criminal case in view *806 of the facts that the state is the defendant's opponent, that the proceeding is commenced on petition of the district attorney (Welf. & Inst. Code, §§ 3100, 3100.6), that the defendant is entitled to be present at the hearing and to be represented by counsel at all stages of the proceeding (Welf. & Inst. Code, § 3104), that if he is financially unable to employ counsel he is entitled to appointed counsel (Welf. & Inst. Code, § 3104) and that his liberty is at stake. On the basis of these considerations, we have recognized the criminal features of the proceeding and held that persons involuntarily committed to the program have the right to a free transcript on appeal, a rule ordinarily applied in criminal cases. (People v. Victor, 62 Cal.2d 280, 288-289 [42 Cal. Rptr. 199, 398 P.2d 391].)
"Whether any particular rule of criminal practice should be applied in a narcotic addict commitment proceeding depends upon consideration of the relationship of the policy underlying the rule to the proceeding." (People v. Moore (1968) 69 Cal.2d 674, 681 [72 Cal. Rptr. 800, 446 P.2d 800], overruled on other grounds in People v. Thomas, supra, 19 Cal.3d at p. 641, fn. 8.)
Consideration of physical aspects of confinement for narcotics rehabilitation is an approach used by the courts to determine the effect of such a commitment.
"... if the court finds that a person is addicted to narcotics or in imminent danger of addiction it has no option but to order him committed `to the custody of the Director of Corrections for confinement in' the California Rehabilitation Center (hereinafter CRC). (§§ 3050, 3051, 3106.5; see People v. Superior Court (Warpole) (1971) 21 Cal. App.3d 911, 914 [98 Cal. Rptr. 894].) At this stage of the proceeding there is no half-way house, no probation alternative.
"Although the CRC is not among the facilities specifically listed as state prisons (Pen. Code, §§ 2000-2049.6), it is nonetheless `under the jurisdiction of the Department of Corrections' (Welf. & Inst. Code, § 3300), its `supervision, management and control' is vested in the Director of Corrections (§ 3305), and its superintendent is appointed `pursuant to Section 6050 of the Penal Code,' which provides for the appointment of state prison wardens (§ 3304). The purpose of the CRC is not only treatment and rehabilitation but also the `control' and `confinement' of persons committed thereto. (§ 3301; see also §§ 3000, 3001.) The rules governing the facility are made by the Director of *807 Corrections (§ 3303), and the general state prison regulations of part 3 of the Penal Code `apply to said institution as a prison under the jurisdiction of the Department of Corrections and to the persons confined therein insofar as such provisions may be applicable.' (§ 3305.) Finally, every person who escapes or attempts to escape from such custody `is guilty of a crime punishable by imprisonment in the state prison.' (§ 3002.) In short, as we recently characterized this confinement, a person committed or recommitted as a narcotics addict `is incarcerated in the walled facility at Norco [i.e., the CRC], a security institution....' (In re Bye (1974) ... 12 Cal.3d 96, 102 [115 Cal. Rptr. 382, 524 P.2d 854].)" (People v. Thomas, supra, 19 Cal.3d 630, 638-639, fn. Omitted.)
Our Supreme Court considered "`the character of the institution and its inmates together with the nature of the proceedings leading to confinement therein'" in determining that a prior term in the Philadelphia County Prison was a separate term within the meaning of California's former habitual criminal statute. (In re Wolfson (1947) 30 Cal.2d 20, 29 [180 P.2d 326].)[7]
The court in People v. Pettersen (1968) 268 Cal. App.2d 263 [73 Cal. Rptr. 693] was faced with the issue whether destruction of property at CRC came within former Penal Code section 4600, which proscribed the destruction of any jail or prison. Defendant argued that he was not in a jail or prison, but in a hospital, since his commitment was civil in nature. In rejecting that contention, the Pettersen court concluded that a person could be committed under a civil commitment, but still be confined to a prison. The court relied not only on the physical characteristics of the center, but on the clear legislative intent to consider the center as a prison. (Id., at pp. 265-266.)[8]
Based upon the legislative provision that a narcotics rehabilitation center be considered a prison, the physical characteristics of such a center, and the dual purpose of narcotics commitments, we hold that *808 time served at CRC is a term in a penal institution within the meaning of Penal Code section 666.

III

(4) WAS APPELLANT'S 1975 CONVICTION CONSTITUTIONALLY INVALID? NO.
Appellant attacks his 1975 petty theft conviction, which followed his plea of guilty, on the ground that the docket does not clearly show that the trial court found that he had voluntarily, intelligently and knowingly waived his various constitutional rights. Appellant acknowledges that both he and his attorney signed a waiver form which fully set forth his rights and which informed him that he was waiving them by pleading guilty. The docket sheet complies with the requirements of Mills v. Municipal Court (1973) 10 Cal.3d 288 [110 Cal. Rptr. 329, 515 P.2d 273]. The court need not explain to defendant his various rights and the effect of his waiver, but a waiver must be signed and acknowledged by the defendant. (Id., at p. 305; People v. Vidaurri (1980) 103 Cal. App.3d 450, 466-467 [163 Cal. Rptr. 57].)
We note also that the challenge by the appellant to the prior conviction was untimely. A pretrial motion to strike the prior conviction must be made. (People v. Coffey (1967) 67 Cal.2d 204, 215 [60 Cal. Rptr. 457, 430 P.2d 15].) Here, appellant did not question the prior conviction until after the People and the defense had rested at the time of trial.

IV

(5) DOES APPLICATION OF SECTION 666 VIOLATE EQUAL PROTECTION? NO.
Appellant argues that by using his two prior convictions pursuant to Penal Code section 666 he has been denied equal protection of law. He reasons that at the time of his arrest on the two prior occasions he served several days in custody because he was unable to afford bail. Other individuals who have been arrested for this offense and have been able to post bail have been released at or soon after booking. Appellant then contends that the only difference between his situation and that of others who were able to post bail is that he was indigent and others have not been. Therefore, the criterion of section 666, prior jail term, is constitutionally impermissible.
*809 Appellant's contention must fail. Anyone who is arrested for petty theft, booked and released immediately following completion of booking, whether by posting bail or on his own recognizance, is deemed to have served one day in custody. Such person, although able to afford bail, is considered to have served one day in a penal institution, and therefore comes within section 666.
In addition, appellant has made no showing that he was unable to post bail because of indigency. He likewise fails to show that, at the time of his arrests in 1973 and 1975, either arraigning court refused to reduce bail or release him on his own recognizance because of his indigency.
It has previously been determined that Penal Code section 666 does not result in a disparity in violation of equal protection principles, since the provision authorizes heavier punishment for thieves of all classes who have previously been convicted and suffered certain punishment. (People v. Beaty (1978) 84 Cal. App.3d 239, 243 [148 Cal. Rptr. 319]; People v. McDaniels (1958) 165 Cal. App.2d 283, 286 [331 P.2d 450].)
The judgment of the trial court is affirmed.
Hopper, Acting P.J., Zenovich, J., concurred.
NOTES
[*]   Assigned by the Chairperson of the Judicial Council.
[1]  Credit for time served was established at the time by former section 2900.6, which provided: "In all misdemeanor convictions, either by plea or by verdict, when the defendant has been in custody, either without bail or because of his inability to post bail, all days of custody of the defendant from the date of arrest to the date on which the serving of the sentence imposed commences shall be credited upon his sentence, or credited to any fine which may be imposed, at the rate of not less than twenty dollars ($20) per day, or more, in the discretion of the court imposing the sentence. If the total number of days in custody exceed the number of days of the sentence to be imposed, the entire sentence shall be deemed to have been served. In any case where the court has imposed both a jail sentence and a fine, any days to be credited to the defendant shall first be applied to the sentence imposed, and thereafter such remaining days, if any, shall be applied to the fine.

"For the purposes of this section, credit shall be given only where the custody to be credited is attributable to charges arising from the same criminal act or acts for which the defendant has been convicted." (Stats. 1971, ch. 1678, § 1, p. 3605.)
[2]  After each of the judgments on the prior convictions became final, section 2900.6 was repealed. (See Stats. 1976, ch. 1045, § 3, p. 4666.) In its place, section 2900.5 was enacted as emergency legislation, to become effective June 28, 1978. (Stats. 1978, ch. 304, §§ 1, 2, pp. 632-633.) We see nothing in this statutory change that affects our decision herein.
[3]  Welfare and Institutions Code section 3000 reads in part: "It is the intent of the Legislature that persons addicted to narcotics, or who by reason of repeated use of narcotics are in imminent danger of becoming addicted, shall be treated for such condition and its underlying causes, and that such treatment shall be carried out for nonpunitive purposes not only for the protection of the addict, or person in imminent danger of addiction, against himself, but also for the prevention of contamination of others and the protection of the public. Persons committed to the program provided for in this chapter who are uncooperative with efforts to treat them or are otherwise unresponsive to treatment nevertheless should be kept in the program for purposes of control."
[4]  Welfare and Institutions Code section 3001 reads: "The narcotic detention, treatment and rehabilitation facility referred to herein shall be one within the Department of Corrections whose principal purpose shall be the receiving, control, confinement, employment, education, treatment and rehabilitation of persons under the custody of the Department of Corrections or any agency thereof who are or have been addicted to narcotics or who by reason of repeated use of narcotics are in imminent danger of becoming addicted."
[5]  Welfare and Institutions Code section 3002 reads: "Every person committed pursuant to this chapter or former Chapter 11 (commencing with Section 6399) of Title 7 of the Penal Code who escapes or attempts to escape from lawful custody is guilty of a crime punishable by imprisonment in the state prison. This section does not apply to unauthorized absence from a halfway house."
[6]  Welfare and Institutions Code section 3305 reads: "The supervision, management and control of the California Rehabilitation Center and the responsibility for the care custody, training, discipline, employment and treatment of the persons confined therein are vested in the Director of Corrections. The provisions of Part 3 of the Penal Code apply to said institution as a prison under the jurisdiction of the Department of Corrections and to the persons confined therein insofar as such provisions may be applicable."
[7]  In order to have been an habitual offender subject to life imprisonment, an individual must have, among other things, "served separate terms therefor in any state prison and/or federal penal institution, either in this State or elsewhere, ..." (Former Pen. Code, § 644, subds. (a), (b), repealed by Stats. 1976, ch. 1139, § 261.5, p. 5136.)
[8]  We also note the Attorney General has expressed the belief that CRC is a "state penal institution or agency" within the meaning of Penal Code section 4852.01. (60 Ops.Cal.Atty.Gen. 223, 229 (1977).)
