Is insomnia keeping you from the sleep you need or do you just want to feel more refreshed when you wake up in the morning? A revolutionary new blood test may one day be able to unlock your ability to get a good night’s sleep, enabling you to wake energized and ready to start the day.

First, forget the notion that your sleep/wake cycle is run by the rising and setting of the sun. It’s actually determined by the body’s circadian clock, the internal system that runs 24 hours a day—give or take a few minutes—and by 10 circadian clock genes, each of which leads to the production of certain proteins. Whether we’re alert and ready for action or ready to fall asleep on our feet depends on how slowly or quickly those proteins break down over a 24-hour period.

If you’re someone who falls asleep before the sun sets, that suggests that your genetic clock is likely to be a bit slower than the 24-hour cycle of the clock on your wall. If you’re someone who’s still fired up in the late evening, it’s likely your genetic clock runs a bit faster.

The inability to get a good night’s sleep is often due to a faulty circadian clock. And when a person’s circadian clock is far off from the way it’s supposed to work, it can influence not only nighttime sleep and daytime energy levels but also the time of day when side effects from medications are more likely to occur and when certain drug treatments are most likely to be effective. This has enormous implications for people with chronic conditions such as diabetes, heart disease or high blood pressure, with cancer, or with mental health issues such as depression or anxiety.

So how do you know whether your circadian clock is working normally? The current gold standard is a test that profiles melatonin, a hormone in your blood. It involves spending several hours in a sleep lab and having a blood sample drawn every hour so that scientists can track melatonin levels—a degree of testing most people are not willing to do.

That’s about to change in the near future, thanks to the development of “TimeSignature,” a blood test that looks at your circadian clock genes. It requires just two blood draws, between eight to 12 hours apart, and uses a mathematical formula to determine when and which circadian clock genes are on the job, taking a rest or slacking off. With more research, TimeSignature may one day be able help in the diagnosis of circadian problems such as delayed sleep-phase syndrome, advanced sleep-wake phase disorder, irregular sleep-wake rhythm, non-24-hour sleep-wake rhythm…by a shift-work disorder…or even just by jet lag. This will be invaluable information not only for getting a good night’s sleep but also for effectively treating many health conditions. For instance, armed with this information, a doctor should be able to target the time of day when some kind of intervention will get your sleep cycle back on track and/or help optimize treatment for conditions other than sleep disorders, such as when to take blood pressure medication or even administer chemotherapy for cancer patients.

TimeSignature is currently going throughthe regulatory process required for any new test to come to market, but in the interim the researchers have made the formula available to other scientists who can use it to investigate more precisely the mechanisms by which circadian alignment impacts health. Look for more to come.

In the meantime, you can help boost your sleep/wake cycle with many lifestyle steps. Read What You Eat (Or Don’t Eat) Affects How You Sleep and Timing Is Everything: When to Walk to Treat Insomnia.