And if you have written one before, it might take five years. ;)
At least, that was my actual experience at a game studio. The engine team wanted to rewrite the engine but underestimated how much was there, how much was worth keeping, and how much work needed to be done. But that was a long time ago, and the studio’s now on Unreal.