The more time you spend on your cellphone, the less sleep you’re likely to get, according to a new study from researchers at the University of California at San Francisco. Both quality and quantity of sleep decreased as screen time increased — especially when phones were used right before bed.

“Increased screen time in the hour of and after bedtime, but not the hour before, was associated with greater sleep onset latency,” said lead author Matthew Christensen, UCSF research fellow. “This agrees with the notion that screen use just before attempting to fall asleep may be particularly problematic.”

These results may not come as a surprise, as past researchers have broadcast similar findings. But what makes the UCSF study different is that it found correlations between overall phone time and sleep patterns, too. On average, users spent 38.4 hours per month, or 3.7 minutes per hour, on their phones, though numbers were higher among Hispanic and Black participants. More screen time correlated with less sleep across the board.

The study also used objective measures to monitor screen time rather than relying on self-reported data, as most previous work in this field has done. Researchers recruited 653 participants who were already enrolled in the ongoing UC San Francisco Health eHeart Study, asking them to install an app that recorded phone usage.

“Our study found that, not surprisingly, people spend a lot of time interacting with their phones,” said senior author Dr. Gregory Marcus of UCSF Division of Cardiology. “This was the first study to examine such use in a broad population, directly measuring screen time rather than relying on self-reported use. And, those with more screen time use had poorer sleep.”

As of 2015, about 64% of American adults owned smartphones, though the average lifespan of these devices is only two years. Of those smartphone owners, 68% keep their phones by their bedside while they sleep, possibly resulting in the temptation to check apps or social media at night. The “blue light” emitted by smartphone screens has been associated with decreased levels of melatonin, the hormone that regulates sleep cycles.

Insufficient sleep is linked with other health problems, including depression and diabetes. The U.S. Hispanic population already has a 50% greater risk of diabetes than non-Hispanic whites, and only 38% of Hispanic Americans say they get a good night’s sleep on a regular basis.

So what can you do to better your sleeping habits? Many experts recommend banning technology from the bedroom altogether, and working to make your sleep environment as inviting as possible. For example, 75% of people say they sleep more comfortably on fresh-smelling sheets. And, of course, limit screen time, especially within the hour before bed.