A Charleston man learned how long he will spend in federal prison after he entered a guilty plea on a weapon charge.