Your Dr will advise you how long you should abstain from driving after taking whatever medication you are using. Legally, you should be fine as long as you do have a prescription, follow the Dr's advice, and aren't actually driving impaired. (You would have a defence if you were ticketed or charged for testing positive for THC while driving). If you don't have a formal prescription for THC then its illegal for you to be consuming it and you won't have any defence if the police test you and you return a positive result. The police and courts will probably just want to nail you in that situation. You could only argue it was a residual positive and you weren't impaired at the time, in court. But the police have the test result and you have nothing but your word to argue that, so I don't think it'd be a successful defence.