Anyone who has felt wide awake at 3 a.m. or struggled to stay awake after 7 p.m. knows that the time on the clock face has little to do with how you feel. These interruptions can take a toll on people whose work schedules don’t align with their internal rhythm. A new paper published Tuesday in the Journal of Physiology, however, suggests a well-timed work out can help realign the body’s clock.

Generally speaking, the body’s internal clock — technically the circadian rhythm — is a 24-hour cycle that is governed by the light-dark cycle driven by day and night (and, increasingly, light from our phones). Among its many functions, the clock determines when the body releases certain hormones, controls how awake a person might feel, and even influences calorie burning or mood. In the new paper, Shawn Youngstedt, Ph.D., an exercise scientist at Arizona State University, shows that exercising at specific windows of time during the day shifts the time that the body releases melatonin, a hormone that strongly regulates sleep-wake cycles.

Normally, melatonin levels begin to increase when darkness falls, and then peak in the early hours of the morning before decreasing once again.

But in his trial on 101 people, Youngstedt showed that exercising at 7 a.m. or between 1 p.m. and 4 p.m. “advanced” a person’s body clock, shifting the release of melatonin so an individual felt more alert earlier in the day. Exercising between 7 p.m. and 10 p.m., meanwhile, “delays” the body clock, making people feel more alert later in the day.

Youngstedt found that exercising in the morning or evening hours can produce different effects on the body clock. Pxhere

“On practical terms, the advance and delay would influence times of peak and low points of alertness and sleep,” Youngstedt tells Inverse.

To demonstrate how exercise affected the circadian rhythm of his participants, Youngstedt and his co-authors had their participants participate in a five-day trial. After establishing each person’s unique schedule of melatonin release by taking urine samples, each person ran on a treadmill at a “moderate intensity” at one of eight different times: 1 a.m., 4 a.m., 7 a.m., 10 a.m., 1p.m., 4p.m., 7p.m. or 10p.m. Most workout times caused slight alterations in melatonin release patterns, with several major exceptions. Exercising at 10 a.m. and between 1 a.m. and 4 a.m. seemed to have no effect on body clock.

In his participants, which included men and women aged 18 to 75, there were notable differences in when melatonin began to accumulate and when it began to drop off. For example, the average time of onset was 11:19 p.m. for younger women and men (between 18 and 32), and melatonin levels began to drop, on average, at 8:40 a.m. In comparison, older adults (59 to 75) saw the onset around 9:58 p.m. and the offset around 7:48 p.m.

Given those different cycles, it’s hard to generalize and examine exactly how much exercise shifts this cycle for each individual person. For instance, teens tend to have different melatonin release patterns than adults. But interestingly, the authors write that the “advance” and “delay” effects caused by exercising at different times held across the wide array of people of different ages and sexes in the study — even if the exact timing and duration of those shifts is highly individual.

That said, the paper also notes some downsides of deliberately shifting the body clock. For instance, participants reported a slight increase in depressed mood — though that effect dissipated once the participants returned home in the week after the study. The authors also note that the people in Youngstedt’s trial were all physically active — most reported exercising at least three times per week to begin with — with so the authors caution that this might not apply to everyone.

Still Youngstedt adds that he believes that his findings spell good news for anyone who is looking to shift their internal clock slightly earlier and make mornings a bit easier. For those who have the time, the 7 a.m. time slot or the 1 to 4 p.m. slot could be a sweet spot. But, he adds, for people who can’t stand the idea of an early morning workout, the afternoon seems like a good choice.

“This could be helpful for people who are unwilling or unable to exercise in the morning,” he says.