Complex sentence: After four years he resigned, having reached the rank of midshipman.
Split into simpler sentences: After four years he resigned. He had reached the rank of midshipman.