If the defendant is convicted, any time spent confined in a secure setting while being assessed or receiving competency attainment services must be credited as time served.