Trial court properly determined that defendant was not entitled to have precommitment custody credits applied against commitment period in state hospital to restore competency. In May 2010, G.H. was charged with multiple offenses. He was found incompetent to stand trial and committed to Patton State Hospital, not to exceed three years. The trial court ultimately concluded that G.H. was not entitled to have his precommitment custody credits applied against the commitment. G.H. appealed this ruling. Held: Affirmed. Under Penal Code section 1370, subdivision (c)(1), a defendant who has been found incompetent to stand trial may be committed to a state hospital for three years or a period equal to the maximum term of imprisonment for the most serious charged offense, whichever is shorter. Custody credit may be used to reduce a period of commitment that is measured based on the maximum term of imprisonment. When the maximum term of commitment is three years, however, equal protection and due process principles do not require a defendant’s commitment to be reduced by precommitment custody credits if, in the event his competency is restored and he is convicted, the potential total sentence he is facing is long enough to give him the benefit for any time spent in jail by having that time credited towards his sentence. Here, G.H.’s maximum term of commitment was three years because the maximum sentence he could receive was five years. If his competency was eventually restored and he was convicted, he would be given the benefit of his precommitment custody credit of 285 days when he was sentenced. The purpose of section 1370, which is to restore competency, would not be served by allowing G.H. to deduct his custody credits from the three-year term. Under the circumstances of this case, G.H. was not entitled to precommitment custody credits against his three-year confinement term.