It probably wasn't meant to be taken literally. If it was meant to be taken literally, it's highly influenced by their understanding (or rather lack of understanding) of the Universe. Calling the moon the "lesser light" is very wrong, for example. He basically made plants before he made the sun, which is weird seeing as he probably knew about photosynthesis.
If we're going by "the Bible is divinely inspired and true" then it must be metaphorical, but if we're going with "the Bible was written by people, without divine inspiration" then it might very well be supposed to be taken literally as this might have been their actual "understanding" of the Universe.
According to the story, earth was created in one day (by separating the two waters) and perfected later on through collecting the lower water in the oceans so as to give way for land. Once again, either it isn't literal or it is the product of faulty understanding, as there is no such thing as the "two waters", but this is rather an explanation for rain or something along those lines.
As has been stated, they might not have known that the sun provided all of our daylight.