Genesis 8:6 says 40 days, but this is not the 40 days of rain at the start.
Before this verse, it says that after the rains, in the tenth month is when the ark bumps into the top of Ararat. That’s when Noah opens the window. So a LOT of time has passed.
In the dark.
At the end of forty days, Noah opened the window of the ark that he had made.
Genesis 8:6 (The Contemporary Torah, JPS 2006)