(b)every person sentenced under this Act to imprisonment or detention, during the term of his sentence, notwithstanding that he is discharged or dismissed with or without disgrace from naval service or would otherwise but for this provision cease to be subject to naval law.