Computer real time clocks keep time with a quartz crystal, but are periodically (usually weekly) synchronized over the internet to atomic clocks (UTC), using a system called Network Time Protocol.
Radio clocks keep time with a quartz crystal, but are periodically (often daily) synchronized to atomic clocks (UTC) with time signals from government radio stations like WWV, WWVB, CHU, DCF77 and the GPS system.
This has the dual function of keeping the oscillator running by giving it 'pushes' to replace the energy lost to friction, and converting its vibrations into a series of pulses that serve to measure the time.
In mechanical clocks, this is the escapement, which gives precise pushes to the swinging pendulum or balance wheel, and releases one gear tooth of the escape wheel at each swing, allowing all the clock's wheels to move forward a fixed amount with each swing.
In electronic clocks this is an electronic oscillator circuit that gives the vibrating quartz crystal or tuning fork tiny 'pushes', and generates a series of electrical pulses, one for each vibration of the crystal, which is called the clock signal.
In atomic clocks the controller is an evacuated microwave cavity attached to a microwave oscillator controlled by a microprocessor
A thin gas of cesium atoms is released into the cavity where they are exposed to microwaves
A laser measures how many atoms have absorbed the microwaves, and an electronic feedback control system called a phase locked loop tunes the microwave oscillator until it is at the exact frequency that causes the atoms to vibrate and absorb the microwaves
Then the microwave signal is divided by digital counters to become the clock signal.
In mechanical clocks, the low Q of the balance wheel or pendulum oscillator made them very sensitive to the disturbing effect of the impulses of the escapement, so the escapement had a great effect on the accuracy of the clock, and many escapement designs were tried
The higher Q of resonators in electronic clocks makes them relatively insensitive to the disturbing effects of the drive power, so the driving oscillator circuit is a much less critical component.
This counts the pulses and adds them up to get traditional time units of seconds, minutes, hours, etc
It usually has a provision for setting the clock by manually entering the correct time into the counter.
In mechanical clocks this is done mechanically by a gear train, known as the wheel train
The gear train also has a second function; to transmit mechanical power from the power source to run the oscillator
There is a friction coupling called the 'cannon pinion' between the gears driving the hands and the rest of the clock, allowing the hands to be turned by a knob on the back to set the time.
In digital clocks a series of integrated circuit counters or dividers add the pulses up digitally, using binary logic
Often pushbuttons on the case allow the hour and minute counters to be incremented and decremented to set the time.
This displays the count of seconds, minutes, hours, etc
in a human readable form.