The general rule of thumb for allowing a medication to clear the system is "half life times five."
In example, if the half life of a medication is 8 hours, than it would take 40 hours (8 x 5 = 40) to clear the system.
For more information about medication half lives, see: https://www.drugs.com/article/drug-half-life.html