Yahweh prepared a great fish to swallow up Jonah, and Jonah was in the belly of the fish three days and three nights.
Jonah was able to calculate how long he was in the fish after he came out of it. Obviously he lost all track of time inside the fish.