What time do you go to bed? Ten-thirty? Eleven? Your bedtime has a lot to do with how much sleep you do — or don't — get.

A smartphone app originally developed to help people to manage jet lag has helped researchers get a broad picture of the sleep habits of people from 100 countries worldwide.

Even if you sleep six hours per night, you are still building up a sleep debt.

They used this data to look at the effects society and our personal internal biological clocks have on sleep patterns across the globe.

Societal pressure exerts a big influence on when people go to bed, but internal biological clocks, or circadian rhythms, determine when they wake up, the team found.

The results are a little surprising. “We often think we get up when our alarms tell us to, that the alarm is really the most important signal. And we just ignore what happens when the sun rises. In fact, that is not true,” researcher, Daniel Forger, told TheDoctor. The study supports the idea that the hour at which the sun rises has a significant effect on when people wake up, he added.

Researchers plotted data from different countries based on the average time their citizens go to sleep versus the average time they wake up. The team used this data to determine how much overall sleep people in these countries are getting. What matters most, they found, is when people choose to go to bed.

“What we found is that the average amount of sleep in different countries does not really depend on the average time they wake up, but it does depend on the time they go to bed,” said Forger, a professor at the University of Michigan.

Middle-aged men get the least sleep, often less than seven or eight hours. Women of the same age tend to get about 30 minutes more sleep than men per night. They may get more sleep because they go to bed a little earlier and wake up later.

Bed time and wake time varied less among people 55 years of age or older, compared to those 30 years of age or younger, Forger said.

“It doesn’t take that many days of not getting enough sleep before you are functionally drunk,” said Olivia Walch, another researcher. Being tired contributes to performance declines, even if you think your performance is as good as usual.

The researchers are hoping to collect data from wearables, such as Apple Watch, FitBit and JawBone, to get a better idea of people’s sleep habits when the new version of Entrain, the team’s app, comes out.

The study is published in Science Advances.