When it comes to coffee, there are seemingly two kinds of people in the world: those who need it to function and those who do not. Many java junkies turn to their drug of choice not just first thing in the morning but throughout the entire day, including in the evening hours when they should be gearing up for a good night’s sleep.

A new study published this week in Science Translational Medicine finds coffee doesn’t only pep you up during the day and keep you awake if you drink too much. It also disrupts your internal clock.

For the study, researchers followed five people for 49 days. Each participant took a caffeine pill (about the equivalent of two shots of espresso) each night approximately three hours before bed. Participants in a separate group were exposed to light before bed. (Researchers already know that bright light can delay sleep at night, a reason why many experts say people should stop staring at smartphones, computer screens and tablets at least a few hours before bed.)

Try Newsweek for only $1.25 per week

Researchers assessed changes in the circadian rhythm by measuring the levels of participants’ melatonin, the hormone that’s responsible for inducing sleepiness and keeping the body clock set correctly. The researchers found caffeine appeared to delay the circadian rhythm by as much as 40 minutes, an effect that is equivalent to about three hours of daylight exposure.

The researchers then took their study to petri dishes with human cell cultures. They exposed the cells to high levels of caffeine and found this prevented the circadian cells from signaling when it was time for sleep.

“Not only do these results reinforce the common advice to avoid caffeine in the evening, but they also raise the intriguing possibility that caffeine may be useful for resetting the circadian clock to treat jet lag induced by international time zone travel,” the study says.

However, caffeine’s effects on the body are not the same for everyone. Caffeine is metabolized by the enzyme CYP1A2, and the body’s ability to produce this enzyme is controlled by the CYP1A2 gene. Some people are genetically predisposed to producing less of this enzyme, while others produce more than average. Those who produce more of it are rapid caffeine metabolizers, which means they’re not very sensitive to caffeine. That’s your friend who guzzles a double latte at 11 p.m. and then an hour later says she’s ready for bed—while you’d like nothing better than to talk all night.