*1920Opinion
PETERSON, J.In this case, we hold that the trial court validly required appellant to waive any right to future custody credit, for the time he would spend in a residential alcohol treatment center, as a condition of probation.1 We also hold appellant could knowingly and intelligently waive his right to future custody credit, even though the amount of the prospective credit was then necessarily unknown.
I. Facts and Procedural History
In October 1989, appellant pleaded guilty to second degree burglary (Pen. Code,2 § 459) and to receiving stolen property (§ 496). The court sentenced appellant to concurrent upper terms of three years in state prison, suspended execution of sentence, and placed him on probation on condition he serve two hundred forty days in the county jail.
In addition to the standard conditions of probation, the court ordered appellant to abstain from the use of alcohol and other intoxicants. In March 1990, appellant was arrested while extremely intoxicated. Appellant subsequently admitted violating the terms of his probation.
In June 1990, the court agreed to reinstate appellant on probation on condition he successfully complete a residential alcohol abuse program at Diablo Valley Ranch (the ranch). Before agreeing to reinstate appellant, the court insisted that appellant waive not only the 196 days of custody credit he had accrued, but also any credit he would earn while waiting in the county jail for a bed to become available at the ranch and for time spent at the ranch. Appellant agreed.
Appellant apparently completed the program; but in January 1991, he was arrested for driving while under the influence of alcohol. Appellant again admitted violating the terms of his probation. The trial court revoked probation and imposed the previously suspended concurrent three-year prison terms. Due to appellant’s prior waiver of custody credit, the court granted appellant presentence credit only for the time in custody after his arrest for drunk driving.
II. Discussion
Section 2900.5, subdivision (a) states in pertinent part: “In all felony and misdemeanor convictions, either by plea or by verdict, when the defendant *1921has been in custody, including but not limited to any time spent in a jail, camp, work furlough facility, halfway house, rehabilitation facility, hospital, prison, juvenile detention facility, or similar residential institution, all days of custody of the defendant, including days served as a condition of probation in compliance with a court order, . . . shall be credited upon his term of imprisonment. . . (Italics added.)3 Our Supreme Court and this court (Division Two) have previously recognized that custody credit under section 2900.5 need not be granted in circumstances which go beyond the requirements of a defendant’s statutory rights under section 2900.5. (See In re Joyner (1989) 48 Cal.3d 487 [256 Cal.Rptr. 785, 769 P.2d 967]; In re Nickles (1991) 231 Cal.App.3d 415 [282 Cal.Rptr. 411]; accord, In re Bustos (1992) 4 Cal.App.4th 851 [5 Cal.Rptr.2d 767].) In the circumstances of this case, the trial court’s requirement that appellant waive potential rights to future custody credit was a valid exercise of its power in specifying the conditions of probation.
We are cited to no case, nor has our research discovered any, which precludes a knowing and intelligent waiver of future custody credit. Here, the waiver served important purposes in (a) resolving in advance the issue as to whether custody credit would apply at all to time spent at the ranch; and (b) allowing the trial court to deny credit for an unsuccessful stay at the ranch, thus avoiding a windfall to appellant. In these circumstances, we conclude the waiver was valid.
Initially, it is debatable whether appellant was even “in custody” at all while at the ranch. The term “in custody” as used in section 2900.5, subdivision (a) has never been precisely defined. People v. Reinertson (1986) 178 Cal.App.3d 320, 326 [223 Cal.Rptr. 670] reviewed several cases in which courts approved the granting of custody credit for time spent in various facilities. The court concluded: “It is clear from the words of the statute and from judicial decisions that, for purposes of credit, ‘custody’ is to be broadly defined. (See People v. Mobley (1983) 139 Cal.App.3d 320, 323 [188 Cal.Rptr. 583] [credit for period of residence in ‘Discovery House’]; People v. Sylvestry (1980) 112 Cal.App.3d Supp. 1, 7 [169 Cal.Rptr. 575] [credit for stay in custodial ‘Impact House’]; People v. Rodgers (1978) 79 Cal.App.3d 26, 31-32 [144 Cal.Rptr. 602] [credit for stay in ‘Delaney Street facility’]; In re Wolfenbarger (1977) 76 Cal.App.3d 201, 205-206 [142 Cal.Rptr. 745] [credit for stay in residential ‘Cri-Help’ program].) . . . The courts which have considered the question generally focus on such factors as the extent freedom of movement is restricted, regulations governing visitation, rules regarding personal appearance, and the rigidity of the program’s daily schedule. [Citation.] [fl] While no hard and fast rule can be derived *1922from the cases, the concept of custody generally connotes a facility rather than a home. It includes some aspect of regulation of behavior. It also includes supervision in a structured life style.” (Id. at pp. 326-327, parallel citations omitted.)
However, the record does not reveal the exact nature of the program at the ranch. The question of whether time spent at the ranch qualified as time “in custody" was neither raised nor briefed in the trial court or on appeal. It is, at the very least, uncertain whether time spent merely drying out at a ranch is really the type of “custody” for which credit should be given, even if the term “custody” is to be broadly defined.
The question of whether a particular facility should be regarded as sufficiently restrictive as to amount to custody constitutes a factual question (cf. People v. Rodgers (1978) 79 Cal.App.3d 26, 32-33 [144 Cal.Rptr. 602]), even though certain facilities by their very nature involve some restraint on untrammeled liberty (see People v. Schnaible (1985) 165 Cal.App.3d 275, 277 [211 Cal.Rptr. 530]). Although it is difficult to conceive of a live-in alcohol treatment program that does not include some modification of behavior and supervision, at least regarding the availability of alcohol, this does not necessarily constitute “custody.”
The trial court recognized, however, that time spent at the ranch might potentially be considered custodial, when the court required appellant to waive the future credit to which he would be entitled by living at the ranch. We assume for purposes of this action that such time was custodial, and that the trial court thereby acted to resolve any such uncertainty implicit in appellant’s case.
Moreover, appellant also “knowingly and intelligently” waived his potential right to future custody credit. A “ ‘knowing and intelligent waiver’ ’’ of a right, it is true, is one entered into with awareness of its consequences. (People v. Harris (1987) 195 Cal.App.3d 717, 725 [240 Cal.Rptr. 891].) An awareness of the consequences of waiving any right should include an understanding of the impact of that waiver on the amount of time a defendant may be incarcerated. (See People v. Howard (1992) 1 Cal.4th 1132, 1174-1180 [5 Cal.Rptr.2d 268, 824 P.2d 1315] reinterpreting In re Tahl (1969) 1 Cal.3d 122, 132-133 [81 Cal.Rptr. 577, 460 P.2d 449] and In re Yurko (1974) 10 Cal.3d 857, 864-865 [112 Cal.Rptr. 513, 519 P.2d 561].) It follows from these principles that, before a defendant agrees to waive *1923custody credit to which he is entitled, he should understand the full consequences of the waiver. Appellant clearly understood that the full consequence of his waiver would be to deny him any custody credit for time spent at the ranch.4
In People v. Harris (1991) 227 Cal.App.3d 1223, the Second Appellate District recognized that the defendant could knowingly and intelligently waive custody credit already accrued. “A defendant may waive custody credit in order to receive other sentencing considerations, if the waiver is knowing and intelligent. [Citations.]” (Id. at p. 1227.) It is true the Second District also implicitly disapproved the trial court’s practice of withholding from appellant the total time he was waiving—in that case, more than four years. (Ibid.)
However, in the present case, the trial court did not withhold any information from appellant. Appellant was ordered to remain in the county jail “until bed space is available at the residential program,” and then to remain in the program “until you successfully complete said program to the satisfaction of the Program Director and your supervising Probation Officer.” Under these conditions, it was impossible to inform appellant of the potential magnitude of the right he was agreeing to waive, because no one, including the trial court, could determine in advance how long the relevant period would be. The mere fact that the right to custody credit could not then be defined with mathematical precision does not render the waiver invalid. In fact, the trial court’s action made appellant’s situation more certain, not less; it resolved in advance the uncertain question of the extent to which time spent at the ranch could produce custody credit. Here, appellant possessed all the relevant facts, to the extent they could be ascertained, and made a knowing and intelligent waiver of future custody credit. Therefore, we conclude that appellant’s waiver of his right to future credit was valid.
Cases arising from waiver of past, accrued credit support our result. It is well settled, for instance, that a trial court, acting on a defendant’s valid waiver thereof, may strike all custody credit already accrued. (People v. Johnson (1978) 82 Cal.App.3d 183, 188 [147 Cal.Rptr. 55]; People v. Zuniga (1980) 108 Cal.App.3d 739, 742 [166 Cal.Rptr. 549].) In Johnson, the court addressed the dilemma a sentencing court faces when confronted *1924by a probation violator who has already served a year in the county jail. Section 19.25 provides that a defendant may not be sentenced to more than one year in the county jail as a condition of probation, and section 2900.5 mandates that all days spent in custody as a condition of probation be credited on a prison term. The court concluded that on their face “The net result of these two legislative efforts is that if a defendant has served a year in jail as a condition of probation, a violation means either a prison sentence or a fatherly (or motherly) lecture on the evils of crime.” (People v. Johnson, supra, 82 Cal.App.3d at p. 185.)
The court noted, however, that the legislative histories of section 19.2 and section 2900.5 make clear that the intent of the legislation was simply to benefit the prisoner and not to satisfy any other overriding social, political, or fiscal purpose. (People v. Johnson, supra, 82 Cal.App.3d at p. 185, fn. 2.) Therefore, the court in Johnson concluded that a proper interpretation of section 2900.5 permits the court, given a defendant’s consent, to sentence a probation violator to additional jail time by striking previously accrued custody credit. (82 Cal.App.3d at p. 188.) Relying on the reasoning in Johnson, the court in People v. Bailey (1983) 140 Cal.App.3d 828, 831 [189 Cal.Rptr. 918], held that, given a defendant’s informed waiver, the trial court may impose a sentence in excess of the one-year limitation in county jail mandated by section 19.2. Inherent in the Johnson and Bailey holdings is the concept of the exchange of defendant’s statutory right for the benefit of a less onerous disposition than would otherwise be available. The waiving of future credit involves similar considerations here.
This does not mean, of course, that we would endorse a situation in which the denial of future credit enabled the court to impose a term which is longer than the maximum allowable for the offense. Even if a defendant agrees to such a negotiated disposition, a trial court should not impose a sentence in excess of the maximum allowable for the plea entered. Appellant would be entitled to discharge from custody at the ranch if and when his total custodial time, including time at the ranch, equaled the maximum incarceration period. That situation is not presented in this case.
Moreover, appellant is also not eligible for “conduct credit” pursuant to section 4019 (see fn. 3, ante), because he was not confined to a penal institution. (People v. Palazuelos (1986) 180 Cal.App.3d 962, 964-965 [226 Cal.Rptr. 31].) Section 4019 states in pertinent part that, for each six days of actual confinement in a county jail, industrial farm, or road camp, one day shall be deducted from a prisoner’s period of confinement for good behavior *1925and one day shall be deducted for performing any labor that was assigned. The legislative purpose of the provision for “conduct credit” is to encourage prisoners to conform to regulations and to refrain from engaging in criminal, particularly assaultive, behavior while in custody. (People v. Saffell (1979) 25 Cal.3d 223, 233 [157 Cal.Rptr. 897, 599 P.2d 92]; People v. Darnell (1990) 224 Cal.App.3d 806, 811 [274 Cal.Rptr. 110].) The control of conduct credit is obviously an important disciplinary tool for the efficient administration of penal institutions.
The custody credit in issue here under section 2900.5, for time spent at the ranch, does not implicate such considerations.6 In fact, the denial of custody credit serves a valid rehabilitative purpose here: A defendant knows if he fails on probation, the trial court retains the power to sentence him to a substantial term, unimpaired by a mechanical scheme unsuited to these circumstances. A defendant denied credit under section 2900.5, subdivision (a) for time spent in an alcoholic treatment program as a probationary condition is given a greater incentive to succeed in that program and as a probationer, because he cannot manipulate the court into allowing him to simply satisfy his sentence based upon time spent drying out at a ranch, rather than in jail or prison. This sentencing option is a salutary goal for insuring optimum chances of success in a treatment program, while reserving an appropriate sentence if, despite the opportunity received, the treatment program and probation are not completed.
We, therefore, conclude that the trial court did have the authority, on a valid waiver by appellant, to deny future custody credit for time spent in a residential treatment program as a probationary condition.
III. Disposition
The judgment is affirmed.
Smith, Acting P. J., and Benson, J., concurred.
We ordered the issue briefed after an independent review of the record as required by People v. Wende (1979) 25 Cal.3d 436 [158 Cal.Rptr. 839, 600 P.2d 1071].
A11 subsequent statutory references are to the Penal Code.
Custody credit is to be distinguished from conduct credit under section 4019.
We quote from the relevant portion of the transcript: “The Court: What that means is if you take one drink, Mr. Ambrose, you are going to go to state prison and you don’t get credits for the time you have been in custody. If you are not serious about this, bite the bullet and take advantage of credits. . . . [HI • • • 110 [Appellant:] I waive credits. [[[] The Court: Think about that. You . . . flunked once and you flunked it pretty good and flunked more than one time. One joint, one drink and it’s state prison. You don’t get any credit for the time you spend in there. [j[] [Appellant:] I can make it. I will waive my time.”
Section 19.2 was renumbered from section 19a in 1989. (Stats. 1989, ch. 897, § 6, p. 3060.)
Thus, this decision is not applicable to a hypothetical waiver of conduct credit for time spent in state prison.