How was accurate time established before electronic communication?

Pocket watches, wrist watches, grandfather clocks, and large church clocks do not actually require electronic powering. They are put together using gears and simple machines; in other words they are mechanical and not electronic. Before electricity was used to power watches and clocks, they had to be wound on a regular basis. Before clocks and watches, time was kept track of by the position of the sun in the sky.