Time in port varies by itinerary. In most ports the ship is docked somewhere from 7 to 10, maybe 12, hours, especially in the Caribbean. The sponsored excursions should get you back to the ship on time - barring any serious unforeseen incidents. Be mindful of the time if you are out on your own.
All I ask is a tall ship and a star to steer her by; John Masefield
Carnival: Glory 2004, Destiny 2008, Splendor 2009, Freedom 2011, Valor 2012, Dream 2013
Celebrity: Summit 2011
Princess: Ruby 2010, 2014, Caribbean 2013, Coral 2014, Regal 2014, 2016, Royal 2017
Star Clippers: Royal Clipper 2015