In the case of old ships, it was all about navigating very precisely by comparing moving visual reference points (i.e., stars), against a reference that then derives the location based on one's position relative to those reference points at a given time.
Any increase in error in either of the two inputs will cause significant positioning errors. The quality of the sextant and the navigator determined the error of the visual reckoning of one's position relative to the stars, the time error was down to the quality of the on-ship chronometer. A trustworthy deck chronometer used to be one of the most important pieces of tech on the planet. Zeroing that chronometer to a trustworthy timekeeping reference while in port is the idea here.
If the earth neither orbited nor turned, the time component wouldn't be necessary. (That isn't entirely true: nothing in space-time between the navigator and the stars would be able to move without introducing an error rate, but the error rates would probably be low enough for that not to be a factor. If I were less lazy and more educated I'd try to work out how much error that introduces.)
Everyone should buy an inexpensive training sextant (e.g., Davis Instruments Mark III Training Sextant) and learn the basics of how celestial navigation works. (For the inclined, there are also good training videos on YouTube.)
Note: The gun is fired at 1pm because they have to fire it just once thus saving cost. Other ideas were considered such as firing it 9 times at 9pm.
Ships also used Greenwich Mean Time (which this cannon is tied to) and astrological data for local time (which this cannon also used for its time).
Also, as suggested by others (I should have thought of that!) - ships used chronometers to establish their longitude.
(At 56 degrees north, which Edinburgh lies on, a timing error of a second translates into 18 meters or so - an order or two of magnitude below the accuracy of even the best of celestial navigators - but still, might as well make the starting conditions as good as possible.)