Speed is usually of the essence.
The longer the OP waits, the more likelihood of it being more embarrassing for both parties. If the OP waits longer than ten minutes, the guy might think to himself:
What!? (BrEng) How long have my flies been unopened? OR (AmEng) How long was my fly open? We've been talking fifteen minutes, and "now" she tells me!
Next time, a polite harrumph (a clearing of the throat) and a pointed fleeting glance at the gentlemen's buckle area should suffice. One could even quickly point at that area. The sooner this is done the better. Done with a smile is always nicer too.
EDIT Sept 08 2017
The downvotes have mainly objected to the wording of "flies" which is British English and not specific to the US. However, my answer consists of non-verbal gestures and eye contact. Hard to believe that this solution is inapplicable in the Western world.
A British journalist relates an anecdote which illustrates that simple words and a commonly used phrase on both sides of the Atlantic You are flying low can be equally, if not more so, effective.
An entire article, pertinent to the OP's dilemma, is found in the Huffington Post (UK edition).
“Your Flies Are Undone!” - Social Howlers and How to Deal With Them
A while back, I was having afternoon tea, of all things, with some ladies and an elderly gent. […] In the manner of these grand old silverbacks, (the gentleman) his knees were spread wide. I happened to glance down and nearly spat my tea out - he wasn’t just flying low, his under-carriage was practically out on the chair. The ladies had already spotted this wardrobe malfunction; they didn’t know where to look.
I leant over to the old gent - “Hey!” I hissed into his ear. “Your flies are undone!”
“Your fly buttons are undone!”
“What was that?”
“You. Are. Flying. Low!”
“Ohh. Oh! Oh dear me!”
The undercarriage is retracted. The ladies shuffle awkwardly. I busy myself with another sandwich. Later, over a Tio Pepe sherry, the old buffer explained to me how, in starchier times, Brits had a ton of euphemisms for all these social faux-pas. I like them. I like them a lot.
I didn't believe this needed mentioning at all but I am also a woman, consequently, I do relate to the OP's embarrassment.
I just spent 15 minutes talking in the hallway at work with a male coworker (I'm female) […]
I'm tentative about this with a friend/coworker (technically, he's my husband's coworker, but we all work in the same office) because it's awkward and (sort of) implies that you were looking in that general direction.
Therefore, I would still opt for the harrumph, (a discreet cough) a nod and a telling glance at the gentlemen's buckle area. I think it is more polite, potentially less embarrassing than saying "Your fly is open" and (added bonus) you don't have to stumble around thinking of a witty way of saying to a gentleman, "You forgot to zip up your pants."