That days have 24 hours is a long-established convention, which is also related to the rotational motion of the Earth. Pliny the Elder expressed it as a fact that left no room for doubt:
The world thus formed is not at rest, but rotates eternally with indescribable speed, each revolution occupying the space of 24 hours: sunrise and sunset leave no room for doubt. If the sound of this vast, incessantly revolving mass is of enormous volume and therefore beyond the capacity of our ears to perceive it, I cannot easily say for my part.
Pliny the Elder, Natural History
But, surprisingly enough, the hours didn't always last the same. And it is that before clocks existed, even after the invention of sundials, it was difficult to keep track of time.
Listen beautiful relax classics on our Youtube channel.
Sundial at the Temple of Apollo in Pompeii. Photo: Mentnafunangann/Wikimedia Commons