Here's the "law":
UNCLOS - United Nations Convention on the Law of the Sea.
See Innocent Passage In the Territorial Sea
Article 17 and Article 18.
Not 72 hours - just what is needed in case of emergency. Pretty unrestrictive, recognizing that emergencies and repairs have not time schedules.
Story #1: When we were traveling from Vanuatu to New Caledonia we encountered severe weather and dangerous seas into the pass bringing us to Noumea. So we anchored in a bay in the lee of an island several miles outside of the pass. We hoisted our "Q" flag and stayed on board the boat for the several days until wind and seas abated sufficiently to allow us to safely sail on to Noumea. There were plenty of officials (Gendarmes, we assumed) on the island we anchored off - they waved to us each morning as we came out into the cockpit. No hassles when we arrived in Noumea.
However, we heard about several boats who had entered the pass late in the afternoon, and decided to anchor and go ashore. When they continued on their way to check in at Noumea, they were "arrested" and fined a significant amount of money (about $600 in 1993, if my memory serves me right) for their infraction - wanting to walk around is not an emergency.
Story #2: After a spate of really bad weather and dreadful sailing, we arrived in Luganville, Vanuatu. Cruising friends arrived several days later, on a holiday, and couldn't check in until the next day. Here's the rest of the story: Sailing from the Solomon Islands to Vanuatu on the cruising yacht Watermelon.
, in a long log about our trip - scroll down to "Eddie and Barbara". Short version - Barbara had what might have been a medical emergency, Eddie called the Port Captain, and every courtesy imaginable was extended to them, even though they had not checked in yet. This is the way government officials should behave.