Being in the medium fast Exp group, it would take a level 34 Ponyta 24,696 exp to get to level 40 when it evolves. 24,696/75 = 329.28, so you need 330 battles to get the required exp if you're exactly at level 34. 330 battles * 30 seconds = 9,900 seconds or 2 hours, 45 minutes.
Additionally, 30 seconds sounds like you're only counting the time it takes from the start of an encounter to the end of it, neglecting the time it takes to run around in the grass or use Sweet Scent to get the encounter, plus stopping back at the Pokémon Center to restock PP. I'd estimate that would probably tack at least an extra 30-45 minutes. Good luck.