I agree with everything said here.
We do both ... the "you have x number of minutes" and transitional activities. My daughter is 2.5 and she is VERY into "what time is it". She is always looking at the clock (we have several traditional clocks) and asking what time it is or telling us "the big hand is on the 3". She can recognize her numbers, so we utilize various moments to encourage her clock curiosity. If we are at a play date, and it is getting time to leave I will say "you have 5 more minutes to play. That means you can do "x" one more time" or I will tell her "you have 5 more minutes to play, when the big hand is on the 4 (or whatever number it will be on) we have to get ready to leave"
Think about YOUR child and what works for him at home then try to incorporate that outside the home keeping in mind little kids DO need that transition time. My daughter loves to feel like she got "just a little bit more play time" .... whether it is in the shower, or playing before going to bed... whatever.
Now, if she DOESN'T follow instructions, there are consequences. I try to keep in mind something that I can use to take away. For example, my daughter LOVES to play princess and wear her crown. I often will take that away if she throws a temper tantrum. I am sure to let her know the expectations before hand and have her repeat them back to me. Then there are no surprises.
Good luck!