Updated

Want to sleep better? Go outside, recommends a new study.

A recent University of Michigan study found, unsurprisingly, that getting outside during the day helps people fall asleep more quickly and get more sleep at night. Indoor light isn't quite as helpful as actual sunlight.

The Center for Disease Control and Prevention generally recommends removing all devices from the bedroom to get a better night's rest, but a smartphone app created by the University of Michigan is helping to illuminate how people sleep around the world.

Related: Rest Well, Live Well: 10 Sleep Hacks to Help You Live Your Best Life

Back in 2014, a group of researchers from the university released a free app for iOS and Android called Entrain to help travelers get over jetlag faster by monitoring users' circadian rhythms and then advising them when to change the light in their environment to aid in the adjustment to a new time zone. During the first year in the app store, 8,070 users sent in their results.

Study authors mathematics professor Daniel Forger, assistant professor Amy Cochran and graduate student Olivia Walch found that the average minimum sleep duration ranged from seven hours and 24 minutes in countries such as Japan and Singapore to a maximum average duration of eight hours and 12 minutes in the Netherlands. The average sleep duration for U.S. residents was 7.87 hours.

Related: How CEOs Optimize Their Sleep Schedule

The data also showed that women go to sleep earlier and wake up later than men, getting about 30 minutes more sleep on average. Researchers also found that age plays a role in sleep patterns, identifying more similarities between the patterns of users 55 and older and more variety for people 30 and under. Middle-aged men get the least amount of sleep, logging less than the CDC recommended seven hours per day.

"It doesn't take that many days of not getting enough sleep before you're functionally drunk,” explains Walch in a statement from the University. "Researchers have figured out that being overly tired can have that effect. And what's terrifying at the same time is that people think they're performing tasks way better than they are. Your performance drops off but your perception of your performance doesn't.”