We've all heard the old adage "you are what you eat," but now a new study shows that when you eat might be just as important.

At least that's according to findings published in the journal Science, which found that by limiting the time span during which fruit flies could eat, they could prevent aging- and diet-related heart problems.

Previous research has shown that people who regularly eat later in the day and at night have a greater risk of developing heart disease than those who eat at more normal times. So to better understand how eating late plays into heart health, researchers at San Diego State University and the Salk Institute for Biological Studies looked to fruit flies, which have long been used as model organisms to identify the genetic basis of human disease, including cardiovascular disease.

In the study, there were two groups of 2-wwek-old fruit flies, each fed a standard cornmeal diet over a three-week period. One group could eat all day every day while the other group only had access to the food for 12 hours a day. Meanwhile the team measured their sleep, body weight and heart physiology.

What they found was the flies with a restricted eating schedule slept better, gained less weight and had far healthier hearts than their binge-eating counterparts. Though, it should be noted that both groups ate similar amounts of food during the study.

"In very early experiments, when we compared 5-week-old flies that were fed for either 24 hours or 12 hours, the hearts of the latter were in such good shape that we thought perhaps we had mistaken some young 3-week-old fruit flies for the older group," lead author Shubhroz Gill said in a statement. "We had to repeat the experiments several times to become convinced that this improvement was truly due to the time-restricted feeding."

What's more, it turns out that it doesn't matter if you start a more restricted diet earlier or later in life, it still provides the same heart benefits. There was even some degree of heart protection in flies that went back to their "eat anytime" ways.

The researchers also discovered that genes responsible for the body's circadian rhythm are integral to this process, but the underlying mechanisms still remain a mystery.

"Humans don't consume the same food every day," Gill noted. "And our lifestyle is a major determinant of when we can and cannot eat. But at the very minimum, our studies offer some context in which we should be pursuing such questions in humans."

For more great nature science stories and general news, please visit our sister site, Headlines and Global News (HNGN).