Here is an interesting idea I came across in a book called "The Bible Unauthorized" by H. Moose:
It says in Tehillim(30:5): "His anger lasts but a moment"
and in Isaiah (26:20): "Hide yourself or one moment until the anger (of Hashem) is past over".
Now one event stands out from the rest in terms of Hashem's anger, that of the flood.
The flood was started by 40 days and nights of rain.
Another important event that took 40 days and nights was the giving of the Torah to Moshe.
One explanation is that Hashem extends the time it takes Him to do an act if the world would not be able to handle it in one moment.
In the case of the flood, the destruction occurring in one moment would have been too much for the world to tolerate, and in the case of the Torah, the whole Torah being given to Moshe in one moment would have been too much for him to endure.
According to "The Bible Unauthorized" (I would very much appreciate it for someone to find a source for this), a "moment", (not a rega, but rather the shortest time for a person to do a meaningful act) is (864/90) seconds, which is about 10 seconds.
Now, in one day we have (24hours/day*60min/hour*60sec/min) = 86,000 seconds.
The number of "moments" in a day is then: 86,000/(864/90) = 9000.
Now, from tehillim, we know that one "day" for Hashem is equivalent to 1000 years for us.
Now this next part is a little fudgey. What definition of "year" do we use? The solar year would be 365 days, and the lunar year would be 354 days plus a bit, which could be said to be 355 days (this also happens to be the gematria of the Hebrew word for year, shanah). So here, we take an average of 365 and 355, so a year for our purpose is 360 days.
So now, one "day" for Hashem is (1000years*360days/year*24hours/day*60min/hour*60sec/min) = 31,104,000,000 seconds.
We note that (40days*24hours/day*60min/hour*60sec/min) = 3,456,000 seconds.
So, the number of 40 day long "moments" in Hashem's "day" is:
(31,104,000,000/3,456,000) = 9000.
So we see that IF the year can be thought of as having 360 days, and IF the (864/90) has a real source, then we see that both our day and Hashem's "day" each have 9000 parts, and one of Hashem's "moments" is 40 days and nights.