Of course he had a good reliable chinese made 24 hour clock. How else could he know that each day had come and gone?
Looking for logic in the Bible is an exercise in futility. Yeah, Light was supposedly the first thing created; the Sun and stars later. Go figure that one.
The answer I would have given you when I was a christian would have been something along the lines of "A day is defined as one revolution of the earth on it's axis. The sun plays no part in this. The earth spun 4 times on it's axis before God created the sun."