The time that a person charged with the commission of any public offense may have been deprived of his liberty, shall be fully deducted from the prison term that said person must serve if he is sentenced for the same offenses for which he was deprived of his liberty.