How long did Noah build the ark before his sons were born?
In Genesis 5:32, we are told that Noah was 500 when his sons were born. In Genesis 6:3, God said He would destroy mankind in 120 years. Since this was in Noah's records, Genesis 6:9 being the closing line of that record, it is assumed that Noah was the one who delivered that message. The later half of Genesis 6:9 begins the record of Shem, Ham, and Japheth. Their birth is mentioned in Genesis 6:10 and the command to build the ark is recorded afterward. Noah was 600 when the flood began (Genesis 7:11) and 601 when the flood ended (Genesis 8:13).
Therefore, the prophecy about when the world would end came 20 years before Noah's sons were born. Japheth, the eldest was born when Noah was 500. Shem was 100 two years after the flood (Genesis 11:10), so he was born when Noah was either 502 or 503, depending on whether "after the flood" was after the beginning or after the end of the flood. Ham was the youngest and since the boys were born close to each other, he was likely born when Noah was between 504 and 506.
The problem is assuming the prophecy for building the ark came at the same time as the prophecy for how long the world would last. We really don't know how long it took to build the ark. But notice that a part of the command to build the ark was that Noah's son's wives would be included in the passenger list (Genesis 6:18). Therefore not only were the sons born, but they also were married. Therefore, we know that the prophecy for the countdown till the end of the world came well before the command to build the ark.