circadian entrainment
Circadian entrainment is how the body's internal clock gets set to the outside world, the way you reset a wristwatch each day so it does not drift. Left alone in constant darkness, the body's clock keeps running, but at a period close to, yet not exactly, 24 hours. Daily cues, above all the light-dark cycle, nudge it back into step so that internal rhythms line up with the actual day.
The pacemaker is the suprachiasmatic nucleus, which receives light information from special cells in the retina. Each morning, light advances or delays the clock by small amounts according to a curve, the response depending on the time of day light is seen. The clock then drives downstream rhythms, including the daily pattern of cortisol and the nightly rise of melatonin, so the whole body shares one schedule.
Disrupting entrainment is what produces jet lag, when you cross time zones faster than the clock can shift, and the chronic strain of shift work. Cues other than light, called zeitgebers, including meal timing, exercise, and timed melatonin, can also help entrain or shift the clock.