A pilot will be advised by an aeromedically qualified doctor the amount of time it will take the body to process a drug, and add on a certain amount of extra time. This time varies for each drug. All drugs are very different in their sites and times of action: eg, paracetamol may take a few hours to have an effect on your headache as it is absorbed through your gut, whereas aspirin may take 20 mins as it is absorbed through your stomach wall.
Hope this helps.