If you're drinking coffee at five p.m., don't expect to be asleep at 11. That's one of the findings of a new study from the Henry Ford Sleep Disorders and Research Center. Another is that if coffee is making you lose sleep, you might not even realize it.

Everybody knows that caffeine disrupts sleep. Yet there are few if any studies testing how much a particular amount of caffeine taken at a particular time of the day affects sleep. The new study changes that.

Researchers gave participants 400 mg of caffeine — the amount found in two to three typical cups of brewed coffee — up to six hours before bedtime. They found that this amount of caffeine reduced a person's sleep by over an hour, but people were unaware that they were losing any sleep at all.

If you drink coffee and are having sleep problems, coffee may very well be the culprit, no matter what time of day you're drinking it.

Coffee's caffeine content varies widely according to how long it is roasted and the type of coffeemaker used, not to mention whether your cup is regular-size or grande. Lighter roasts contain more caffeine than the stronger-tasting dark roasts do. And the pressure used by espresso makers means that espresso has considerably less caffeine in it than drip coffee does.

Twelve healthy, normal sleepers took pills six hours, three hours and right before bedtime for four days. On three of the days, one pill contained 400 mg of caffeine, while the other two were placebos. On one day, all three pills were placebos to provide a caffeine-free control day.

Sleep and sleep disturbances were measured both by a sleep monitor and self-reported in a sleep diary. The study results indicated that a moderate dose of caffeine, whether at bedtime, three hours, or even six hours before bedtime all significantly disturbed sleep, compared to sleep with no caffeine.

The obvious takeaway of the study is that you should stop drinking coffee more than six hours before you expect to go to sleep. A less obvious point is that if you drink coffee and are having sleep problems, coffee may very well be the culprit, no matter what time of day you're drinking it.

People's metabolisms vary greatly, as does the amount of caffeine in a “cup” of coffee. You might be surprised at the number of ounces of coffee you're actually drinking every day.

Working nights or hours other than nine to five can by itself lead to sleep problems. Adding coffee to the mix might be making a bad situation even worse.

The study appears in the Journal of Clinical Sleep Medicine.