
165 Cal.App.3d 752 (1985)
212 Cal. Rptr. 24
THE PEOPLE, Plaintiff and Respondent,
v.
RODNEY CORNETT, Defendant and Appellant.
Docket No. F003600.
Court of Appeals of California, Fifth District.
March 15, 1985.
*753 COUNSEL
Quin Denvir and Frank O. Bell, Jr., State Public Defenders, under appointment by the Court of Appeal, and Antonia D. Radillo, Deputy State Public Defender, for Defendant and Appellant.
John K. Van de Kamp, Attorney General, W. Scott Thorpe, Lisa Lewis Dubois and James T. McNally, Deputy Attorneys General, for Plaintiff and Respondent.
[Opinion certified for partial publication.[1]]
*754 OPINION
BEST, J.
Because of complexities inherent in the sentencing rules and the rules pertaining to presentence custody credits following adoption of the Determinate Sentencing Act, we are called upon to review the sentence imposed upon defendant, Rodney Cornett, following his plea of guilty to voluntary manslaughter (Pen. Code, § 192, subd. 1) with personal use of a deadly weapon, a knife (Pen. Code, § 12022, subd. (b)) and robbery (Pen. Code, § 211).

FACTUAL AND PROCEDURAL STATEMENT
On August 26, 1983, defendant was arrested by the California Highway Patrol (CHP) in Madera County for drunk driving. At the time of his arrest, defendant was in possession of a wallet belonging to Delbert Perry Weaverling and was also driving Mr. Weaverling's car. Defendant advised the CHP that he had stabbed Weaverling and left him in a fruit orchard along Highway 99.
Defendant related that he had left Las Vegas, Nevada the previous day and had hitchhiked to Bakersfield, California by the early morning hours of August 26, 1983. In Bakersfield, defendant was picked up by Weaverling, and the two continued traveling on Highway 99. Weaverling stopped at a liquor store in Bakersfield and again in Visalia to purchase alcoholic beverages. Near Traver, Weaverling left the highway and pulled into a fruit orchard. At this point, defendant was going in and out of consciousness due to his consumption of the alcohol, and he fell asleep. He was subsequently awakened by Weaverling, who was attempting to remove defendant's pants and fondle his genitals. Defendant observed that Weaverling had removed his own pants and his penis was in an erect state.
Defendant immediately reached into his boot, pulled out a knife and slashed Weaverling on the left forearm. Both men then left the car. Weaverling grabbed defendant in a "bear hug" hold, and defendant stabbed Weaverling in the back and shoulder while pushing him to the ground. Defendant claimed that he stabbed Weaverling no more than three times. He then left the area in Weaverling's car and was subsequently arrested for drunk driving.
At the time of his arrest, defendant had a blood alcohol content of .25 percent. He was in possession of Weaverling's wallet, but the wallet contained no money. The victim had, however, cashed a paycheck for $128 earlier that day. Defendant was also in possession of a bloodstained knife with a four-inch blade.
*755 Weaverling's body was found in a fruit orchard near Traver on September 1, 1983. A subsequent autopsy revealed that he had died of multiple stab wounds. Eleven knife wounds were evident on the body, and at least five of the wounds were from three to five inches deep.
At the scene of the crime and in Weaverling's automobile, numerous pornographic homosexual magazines and pictures were discovered. Defendant's sleeping bag was found on the ground, rolled out, at the crime scene. Defendant indicated he did not recall how his sleeping bag got out of the vehicle.
An information was filed charging defendant with three counts as follows: murder (count I; Pen. Code, § 187), robbery (count II; Pen. Code, § 211) and unlawful driving or taking of a vehicle (count III; Veh. Code, § 10851). The information further alleged that in the commission of the murder and the robbery, defendant personally used a deadly weapon (a knife) within the meaning of Penal Code section 12022, subdivision (b).
On December 13, 1983, the trial court granted the district attorney's motion to amend count I of the information to allege that defendant had committed the crime of voluntary manslaughter, a violation of Penal Code section 192, subdivision 1. On that same day, pursuant to a plea bargain, defendant pled guilty to one count of voluntary manslaughter, one count of robbery and admitted the use of a knife within the meaning of Penal Code section 12022, subdivision (b).[2]
On January 17, 1984, defendant was sentenced to state prison for the upper term of six years on the manslaughter count and received a concurrent term of three years on the robbery count. The one-year enhancement imposed for the Penal Code section 12022, subdivision (b), finding was stayed by the trial court. Defendant's total term of imprisonment thus amounted to six years. Defendant was given a total of 39 days custody and conduct credit.

I[*]
.... .... .... .... ...


*756 II

Defendant is entitled to additional presentence credits.
(1a) Defendant contends the trial court improperly calculated his presentence credits pursuant to Penal Code section 2900.5. We agree.
At the time of sentencing, the lower court granted defendant 39 days of presentence credits. This included 26 days of custody credits plus 13 days of good-conduct/work-time credits.
The facts surrounding defendant's custody are as follows:
On August 26, 1983, defendant was arrested in Madera County on a misdemeanor charge of driving under the influence of alcohol in violation of Vehicle Code section 23152a.
On September 7, 1983, while defendant was in custody in the Madera County jail on the drunk driving charge, a hold was placed on him for the pending manslaughter and robbery offenses which occurred in Tulare County.
On September 13, 1983,[3] defendant was sentenced upon his plea of guilty to the drunk driving charge to 180 days in county jail with 18 days of credit.
On December 22, 1983, defendant completed his sentence on the drunk driving charge.
On January 17, 1984, defendant was sentenced to state prison for the upper term of six years on the pending manslaughter and robbery offenses.
The probation officer who prepared the probation report herein concluded that defendant had been in custody for 133 days but was entitled to only 39 days of credit (26 actual and 13 conduct) from December 23, 1983 (the day after completion of his drunk driving sentence), to January 17, 1984 (the date of his sentencing on the pending crimes).
On appeal, defendant argues pursuant to In re Atiles (1983) 33 Cal.3d 805 [191 Cal. Rptr. 452, 662 P.2d 910] and People v. Schaaf (1983) 150 *757 Cal. App.3d 45 [197 Cal. Rptr. 458] that he should have been given credit for the time he spent in custody from September 7, 1983 (the date of his arrest on the pending offenses), to January 17, 1984 (the date of his sentencing in the instant case). Plaintiff counters that no additional credits apply.
In re Atiles, supra, involved a prisoner serving a prison sentence for a robbery committed while he was on parole. In a petition for writ of habeas corpus he sought credit under Penal Code section 2900.5 for time spent in county jail awaiting trial on the charges which led to his imprisonment. During this custody period, the petitioner was unable to obtain his freedom by posting bail because the Department of Corrections had placed a "hold" on him. Petitioner's parole was revoked pursuant to this "hold," and he was returned to custody for a six-month period. He had been granted credit for only three days of presentence confinement between the parole hold expiration and the prisoner's release on bail by the trial court.
The Supreme Court ordered the trial court to modify its judgment and grant the petitioner credit for the six-month period he was in jail. In a four-to-three decision, the majority rejected the argument that, because the prisoner's sentence of confinement was attributable in part to the revocation of parole, he was not entitled to credit. It held that because the conduct which led to petitioner's arrest and conviction on new criminal charges also formed a basis for the parole hold and subsequent revocation proceedings, his custody in county jail was attributable to proceedings relating to the same conduct for which the defendant had been convicted as set forth in Penal Code section 2900.5, subdivision (b).
The majority in Atiles, however, spoke further on the question of presentence credits. Responding to the Attorney General's argument that if the presentence custody is attributable to unrelated criminal acts it is not attributable to the robbery conviction within the meaning of Penal Code section 2900.5, the Atiles court stated as follows: "[In re Rojas (1979) 23 Cal.3d 152 (151 Cal. Rptr. 649, 588 P.2d 789)] was not a holding that the custody must be attributable exclusively to the conduct underlying the term ultimately imposed.
"In determining whether custody for which credit is sought under section 2900.5 is `attributable to proceedings leading to the conviction,' the sentencing court is not required to eliminate all other possible bases for the defendant's presentence incarceration. The court need only determine that the defendant was not already serving a term for an unrelated offense when restraints related to the new charge were imposed on him, and the conduct related to the new charge is a basis for those restraints....
*758 "We are satisfied that the Legislature intended that `custody ... attributable to proceedings related to the same conduct for which the defendant has been convicted' include time in presentence custody during which a restraint or restraints related to that conduct made it impossible for the defendant to obtain his freedom, regardless of whether the defendant was also subject to other restraints on his liberty. Our conclusion is based on the literal language of subdivision (b) of section 2900.5, pursuant to the well-established principle of statutory interpretation that if no ambiguity, uncertainty, or doubt about the meaning of a statute appears, the provision is to be applied according to its terms without further judicial construction. [Citation.]" (In re Atiles, supra, 33 Cal.3d 805, 810-811, italics added.)
The majority opinion also discussed equal protection of the law problems in the context of presentence credits. "Unequal treatment follows not only from denial of credit altogether for presentence jail time, however, but also from denial of credit on multiple concurrent terms. This may occur if a defendant seeks separate trials on severable charges to insure his right to a fair trial, if a prosecutor does not join multiple counts in a single accusatory pleading, or if a defendant faces charges in more than one jurisdiction. It may also occur in cases such as this in which parole revocation proceedings and new charges are pending simultaneously if the defendant does not promptly plead guilty and seek immediate sentencing. In each of these situations, the possibility of unequal treatment exists if concurrent terms are imposed, but because sentence has been imposed or parole revoked in the first proceeding before the others are tried, credit for time in jail while awaiting disposition of the remaining charges is denied. The terms then are not truly concurrent since the effect of denying credit on the later terms is that they commence only on the date sentence is pronounced. The time between sentencing in the first proceeding and that in the second is, as to the second term, `dead time.' The Legislature has not either expressly or by implication indicated an intent to deny dual credit in any of these situations.
"Were we to construe section 2900.5 as prohibiting dual credit when concurrent terms are imposed in the above circumstances, the legislative purpose of avoiding unequal treatment of prisoners would be frustrated, not furthered. The length of imprisonment would depend upon the fortuitous charging decision of a prosecutor or on a defendant's election to seek separate trials." (In re Atiles, supra, 33 Cal.3d at pp. 812-813, fn. omitted, italics added.)
In People v. Schaaf, supra, 150 Cal. App.3d 45, the defendant was arrested for murder on September 7, 1982. On January 7, 1983, he pled guilty to the lesser offense of voluntary manslaughter and on February 7, 1983, *759 was sentenced to prison for the upper base term of six years. During these proceedings on September 10, 1982, the defendant was sentenced to 180 days in the county jail for violation of probation stemming from a November 12, 1980, conviction for vehicular manslaughter. His probation had been revoked on March 13, 1981, because of a drunk driving charge. On November 17, 1982, the defendant was sentenced to an additional 270 days for the drunk driving offense. In imposing sentence on the voluntary manslaughter conviction, the trial court allowed only four days presentence custody credit for the period from September 7, 1982 (when the defendant was arrested on the murder charge), and September 10, 1982 (the date the defendant was sentenced for violation of probation). This court held that the defendant was entitled to presentence credit for the period from September 7, 1982 (the date of his arrest on the murder charge), to February 7, 1983 (the date he was sentenced on the voluntary manslaughter conviction).
The Schaaf court concluded from Atiles: "[E]xcept for the Rojas situation where the defendant is already serving a sentence when restraints related to the instant sentencing are first imposed, ... a defendant is entitled to presentence credit under section 2900.5 for all presentence jail time spent while awaiting sentence in the pending case. Such presentence jail time is deemed attributable to the pending offense even though restraints on other unrelated cases were also imposed on the defendant, provided that the restraints on the unrelated cases did not precede the restraints caused by the pending case. A contrary holding would fly in the [face] of the Atiles' reasoning that denial of credit on the two theoretically concurrent terms would produce unequal treatment." (People v. Schaaf, supra, 150 Cal. App.3d at pp. 51-52, italics added.)
Unlike In re Rojas (1979) 23 Cal.3d 152 [151 Cal. Rptr. 649, 588 P.2d 789], in the present case the restraints placed on defendant due to the manslaughter and robbery charges preceded his sentencing on the drunk driving charge.
Plaintiff contends that, under Schaaf, defendant is not entitled to the custody credit because the restraint placed by the manslaughter and robbery charges did not precede the restraint caused by the arrest in the drunk driving charge. This contention is premised on some of the dicta in Schaaf which stated, "a defendant is entitled to credit for the entire time he spends in jail awaiting sentence if the restraint on the unrelated crime does not precede the restraint caused by the pending case." (People v. Schaaf, supra, 150 Cal. App.3d at p. 47, italics added.)
This "restraint" language in Schaaf has caused problems in this area because of what we conceive to be a misinterpretation of what was intended by "restraint" as used in connection with an unrelated offense.
*760 Justice White in his dissenting opinion in the very recent case of People v. Joyner (1984) 161 Cal. App.3d 364 [207 Cal. Rptr. 636], correctly analyzed the holdings in Rojas and Atiles: "[In] In re Rojas, supra, 23 Cal.3d 152, 156, the court denied credit with the explanation that `[t]here is no reason in law or logic to extend the protection intended to be afforded one merely charged with a crime to one already incarcerated and serving his sentence for a first offense who is then charged with a second crime.' Atiles, supra, 33 Cal.3d 805, 810, acknowledged the Rojas ruling when it prescribed the test to be applied by trial courts: `In determining whether custody for which credit is sought under section 2900.5 is "attributable to proceedings leading to the conviction," the sentencing court is not required to eliminate all other possible bases for the defendant's presentence incarceration. The court need only determine that the defendant was not already serving a term for an unrelated offense when restraints related to the new charge were imposed on him, and the conduct related to the new charge is a basis for those restraints.'
"The Rojas exception was for one serving a `sentence.' Atiles restated that the exception applied to one serving a `term' when the restraints related to the new charge were imposed." (People v. Joyner, supra, 161 Cal. App.3d at p. 370, fn. omitted.)
That the Schaaf court recognized this limitation upon the word "restraint" as used in connection with an unrelated offense is demonstrated by the quoted portion of their opinion set out above.
In People v. Joyner, supra, 161 Cal. App.3d 364, the majority held that a defendant was not entitled to presentence credit from the time a hold was placed on him until the time he was sentenced because at that time he was already in custody, although on an unrelated charge.
We believe that the majority's reliance on Schaaf in arriving at that conclusion resulted from a misinterpretation of "restraint" in connection with an unrelated offense as used in Schaaf.
When "restraint" as used in Schaaf in connection with an unrelated offense is limited to one who has been "sentenced" or who is serving a "term" for the unrelated offense, Schaaf is complete harmony with both Rojas and Atiles.
(2) We hold the correct rule to be as follows: When a defendant has been sentenced and is serving a term in custody on an unrelated offense, he is not entitled to presentence credit upon being sentenced for a present offense; however, when a defendant is in custody on an unrelated offense *761 but is not serving a term pursuant to a sentence on the unrelated offense, he is entitled to presentence credits against a sentence on the present offense from the time a restraint is placed on him for the present offense.
(1b) Applying this rule to the case at bench, defendant is entitled to presentence credits from September 7, 1983, to January 17, 1984, or 133 days, plus 66 days conduct credits (Pen. Code, § 4019, subd. (a)(2)), for a total credit against the sentence imposed of 199 days.
Our holding demonstrates the fallacy in plaintiff's further contention that defendant is not entitled to the presentence credit because he had completed his sentence on the drunk driving conviction before he was sentenced on the manslaughter and robbery convictions. Once the hold was placed on defendant on September 7, 1983, his continued incarceration was at least partially attributable to the manslaughter and robbery charges on which he was subsequently sentenced. When defendant completed his sentence on the drunk driving charge as of December 22, 1983, his continued incarceration until January 17, 1984 (the date he was sentenced to state prison on the pending manslaughter and robbery charges), was attributable solely to these pending charges. Our holding herein is, therefore, consistent with the opinion of this court in People v. Veley (1984) 157 Cal. App.3d 1046 [204 Cal. Rptr. 83]. There, in October 1980, the defendant had pled guilty to possession of phencyclidine (PCP) for sale. He was granted three years probation, one condition being that he serve six months in the county jail. After completing that local sentence, he was arrested twice in June 1982 for being under the influence of PCP. He received a jail sentence of 120 days on these new misdemeanors and completed that sentence in November 1982. In December 1982, the trial court revoked the defendant's probation in the principal action after taking judicial notice of the two misdemeanor convictions. The defendant was thereupon sentenced to state prison for the middle base term of four years.
This court held that the defendant was entitled to presentence credit not only for the time spent in custody as a condition of probation, but also for the time spent in custody for the misdemeanor convictions, stating, "Though here defendant seeks credit for the time spent as a result of misconduct during a grant of probation, the Atiles reasoning applies. The new charges caused the revocation of probation on the original charge and were thus `reasonably related' to the prison term on which credit is sought. Defendant was not already serving a term for an unrelated offense which never became associated with the principal term against which credits are claimed." (People v. Veley, supra, 157 Cal. App.3d at p. 1049, italics added.)
*762 While in the instant case the trial court could not run the felony violations concurrent or consecutive to the drunk driving sentence because it had been completed, in such a situation, due to the "accidents of timing" the benefit of the doubt should go to the defendant, i.e., if given the opportunity the court would have run the sentences concurrently. (In re Atiles, supra, 33 Cal.3d 805, 812; People v. Schaaf, supra, 150 Cal. App.3d 45, 51.) Our holding is consistent with Penal Code section 669 regarding concurrent and consecutive sentencing and avoids potential equal protection violations.

III[*]
.... .... .... .... ...

IV

DISPOSITION
The judgment is modified to provide that defendant shall receive presentence actual time and conduct credits totaling 199 days for the period September 7, 1983, to January 17, 1984. The trial court is directed to prepare an amended abstract of judgment which reflects that modification and forward a certified copy of same to the appropriate authorities. As so modified, the judgment is affirmed.
Hanson, (P.D.), Acting P.J., and Hamlin, J., concurred.
NOTES
[1]  Parts I and III of this opinion are not published, because they do not meet the standards for publication contained in California Rules of Court, rule 976(b).
[2]  The vehicle theft count and the deadly weapon allegation accompanying the robbery count were apparently dismissed on the People's motion at the time of sentencing.
[*]   See footnote 1, ante, page 752.
[3]  The record does not reflect the date of defendant's sentencing on the Madera County drunk driving. Plaintiff contends it was on September 13 and defendant contends it was on September 23. We find it unnecessary to resolve the exact date of defendant's sentencing on the drunk driving charge insofar as it has no bearing on the issue before this court.
