If you enjoy a late-night coffee, you can rest easy—literally.

Millions of people would readily admit that they can hardly get out of bed and start their day without a morning cup of coffee. Many therefore justifiably assume that drinking everyone’s favorite energy-providing bean juice within a few hours of bedtime will inevitably lead to restless sleep, thereby necessitating an even stronger cup of coffee the following morning to compensate.

Well, if you’re the kind of person who enjoys an evening cup of coffee or an after-dinner cappuccino, you can rest easy—literally. That reassurance comes courtesy of a new study jointly conducted by Harvard Medical School and Florida Atlantic University which recorded the effects of caffeine, alcohol, and nicotine on sleep duration and efficiency. Based on observing 785 participants across a total of 5,164 nights using data from both self-recorded sleep journals and wearable actigraphy sensors, researchers concluded that there was no association between consumption of caffeine within four hours of bedtime and the quality or duration of sleep.

Conversely, both alcohol and nicotine consumption within that four-hour window were shown to affect sleep. Specifically, nicotine consumption reduced sleep duration by 42 to 47 minutes. Likewise, if you want to enjoy a relatively uninterrupted night’s sleep, you might want to head home before happy hour is even over.

It’s worth noting that the study isn’t suggesting that chugging black coffee after you’ve put on your pajamas is a great idea. As ScienceDaily summarizes, “the researchers warn that caffeine dosing, and individual variations in caffeine sensitivity and tolerance, were not able to be measured and can play an important role in the association between caffeine use and sleep.” So if you’re the kind of person for whom any amount of caffeine makes you want to jump out of your skin, both this study and common sense would dictate that you should still lay off the java before bedtime.