Depending on your tolerance and the amount you take, of course, the average seems to be 6-8 hours, though the afterglow can last clear into the next day, especially if you enter the higher plateaus.
if you're doing a normal amount, you should be ok to act straight in about 5 hours, and not much noticible effects after 7 hours, but thats just from my experiences. you could be very different
I think it is rather interesting that DXM seems to follow a rule of thirds (src: Erowid). Roughly one third of the people who try DXM like it enough to ever repeat the experience; one third hates it, and one third doesn't enjoy it enough to drink cough syrup. Though this rule may have changed slightly with the availabilty of gel caps and a few other sources (powder if you can find it), I think it still holds pretty true. The high you get from DXM is not simple and usually not easy. It seems also that many people may simply be incapable of metabolizing DXM so that the trip is enjoyable. It is also the case that while the trip may be enjoyable in the first or second plateau, in the third in fourth you are more likely to have a very intense trip that may not be at all enjoyable. Most people who intentionally visit those upper plateaus are looking for spiritual insight. In the low plateaus, you are likely to be able to function in public for most of the trip, and certainly appear pretty normal to passersby an hour or two after the peak of the trip (add another hour or two for people who know you well, as the effects will still be noticable to someone who's paying attention). For me it is usually about 6 hours after the trip starts (about an hour after ingestion of gelcaps) before I can go out in public without worrying about acting totally spacy, but others I know report it taking only about 4 or 5 hours. In the upper plateaus, you should add at least two hours to the length of time it will take for you to function normally, but don't forget the afterglow that often occurs with the trip. You may be a bit spaced out for a while.