Offender was not entitled to custody credit for pretrial confinement on new charge because he remained confined under unrelated insanity commitment. While Callahan was confined at Napa State Hospital (NSH) on a 1997 insanity commitment pursuant to Penal Code section 1026, he was charged with battery on a hospital guard in 2004. He was found incompetent to stand trial and the maximum commitment of three years was imposed under section 1370, subd. (c)(1). The court awarded credit for time served for the pretrial confinement related to the criminal charge. The prosecutor appealed, contending that Callahan was entitled to no credits because his liberty was already restrained by the insanity commitment regardless of the pretrial confinement on the new charge, and further, that he was not entitled to conduct credit for time spent in the nonpenal confines of a state hospital. The court agreed with the prosecutor and reversed. Pretrial custody on the battery charge was just another layer of custody which, if stripped away by the ability to make bail, would not have resulted in Callahan’s liberty. He would have remained confined on the 1026 commitment and therefore was not entitled to actual custody credit. Further, conduct credit under Penal Code section 4019 is not awarded for time spent in nonpenal institutions such as state hospital. Apart from a short period of time spent in the jail, Callahan was housed at NSH pursuant to his insanity commitment while awaiting trial on the criminal charge, being confined for treatment, not punishment. The rationale for conduct credit is not pertinent to the context of psychiatric treatment, and section 4019 did not apply.