Any sentinel or look-out who is found drunk or sleeping upon his post or leaves it before being regularly relieved, shall be punished, if the offense is committed in time of war, by confinement of not more than ten years or other punishment as a court-martial may direct, but if the offense is committed at any other time, by such punishment as a court-martial may direct.