Work it backwards. If you're in such pain that you need opiates to relieve the pain, you're in no shape to fly per 61.53. If you're under the influence of opiates, you can't fly either. Take a break for a couple days.
The other thing to keep in mind is to have a record of the prescription if your name comes up for a drug test. I've forgotten how long opiates remain in your system. Coke went through fairly fast, weed left traces for a weeks.