Depends. Gangrene will only set in if the bullet hit and cut off the circulation to one of the main arteries. Every situation is different and without knowing where the bullet hit and which arteries were injured this question can not be accurately answered. Another and perhaps more important question is: can you move your leg/foot and do you have sensation. If yes, the your foot/leg is viable.
Bloodflow problem. Gangrene develops when tissue is not receiving adequate bloodflow. That tissue is dead or dying. Time for that to happen is variable. Infection is also a factor.