Unfortunately, both, or either :-) Its one of those phrases that's all in the way its said. As you show in your question, it can mean either 'wait an hour before doing that' or 'do that within an hour'. I tend to think that using 'in' for 'within' is not necessarily good english, but it used a lot.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.