The wait time is 24 hours. However sometimes there is a glitch that makes it hang another 24 hours unfortunately. You should check your bagpack for the badge just in case you can't battle the gym leader due to the fact you have it anyway, that happens sometimes. If not and you do wait 48 hours and still can't battle go to the IRC Chat, linked below in my signature, and talk to Reborn.
(naruto that glitch has been fixed)