It's not that cut and dry.
You will get infected if an infected person's virus makes its way into your body.
So you could spend an hour with a person who is positive and be a couple of feet away from them and never become infected, because the infected person didn't expel infected droplets that made their way into your body through some method. Conversely you could be 6 feet away from a person, both of you wearing masks, only for a couple of minute and you could get infected. The infected person could have momentarily touched their mask then the hand rail, then you touch that hand rail. And every other possible situation in between for ways to get it or not get it.
The whole idea with the number of minutes and distance etc. come down to best guidelines from observations made so far to reduce chances as best as possible.
So in general the longer you are near someone that is infected the more chance you have of getting it through various means, and added protection (wearing a mask, increasing the distance from that infected person, not touching surfaces and/or your face etc.) reduce those chances of getting it.
But there are no definitive/precise numbers that will guarantee if you are closer to someone for shorter period of time, or further away for longer periods of time that you will or won't get it.