The Sleepytime Bedtime Calculator does pretty much what it says. You can tell it when you want to get up, and it will tell you what time you need to be asleep. Or, you can tell it when you want to go to bed, er, sleep, and it will tell you when to set your alarm. The idea is really, really basic: REM cycles come, on average, every ninety minutes and you want to time your waking to the moment between those cycles and not in their midst, if you want to feel rested. If memory serves, our biological clocks are a bit more nuanced, and variable, than that, but it was fun to show the thing to my daughter and allow her to figure out when she needs to go to bed, based on the idea that she needs a certain amount of sleep to feel rested.