Studies of mice reveal a possible mechanism
Though dogs cannot relate to abstract human concepts such as minutes and hours, there is plenty of evidence that they can sense the passing of time. Sensory cues including light, temperature and odors throughout the day provide dogs a lot of information about time-sensitive events. For example, they may anticipate that it is time for a guardian to come home because the odor of that person has faded to the degree it always does right before that person returns. Their own sensations can be a factor, too—many dogs know it’s dinnertime because they are hungry, not because they know that it is 6 o’clock or that 10 hours have passed since breakfast.
via Whisker Therapy