In theory: The Dungeon Master keeps careful track of time as the party explores the dungeon, minute by minute, and at prescribed intervals he or she rolls dice for wandering monsters.
In practice: The Dungeon Master rolls for wandering monsters when he or she remembers that wandering monsters are supposed to be rolled for. This usually happens at a time when the party is dithering, arguing, meandering, or otherwise failing to entertain the Dungeon Master. This also happens when the party resorts to noisy, obvious solutions to a problem.
Also applies to torches, lanterns, rations, &c.
My First Time (Toys Without Tots)...
7 hours ago