The desire to measure periods of time dates back thousands of years. The position of the Sun gave early humans the ability to estimate the proportion of the day that had passed, however clocks as we know them today didn’t make their first appearance until the 17th century. Despite their distinctive designs, most clocks are embodiments of the same fundamental idea: exploiting the periodicity of harmonic systems.
Mechanical Time
The simple pendulum is a system comprising a mass on a string fixed at one end, free to move in two dimensions. Prior to an external perturbation, the string rests vertically and the mass is said to be at its equilibrium position. Upon displacement of the mass, the system will undergo simple harmonic motion, swinging back and forth about equilibrium due to the continuous exchange of potential and kinetic energy.
The time taken for the mass to complete a full oscillation is known as the time period and is independent of the size of oscillation. For relatively small swings of the simple pendulum, the time period is solely dependent on the length of the string. A string 25cm in length will provide a subsequent time period of approximately one second and thus becomes an effective method of keeping time. Old-fashioned grandfather clocks are a prime example of this in action.

Electrical Time
Mechanical systems aren’t the only kind that exhibit harmonic properties. Mains electricity is produced by power companies by exploiting natural processes, such as the diffusion of heat, to spin turbines. The motion of the turbine is converted into alternating currents (AC) with identical frequency via a generator. In the UK, the frequency of mains electricity is 50Hz, meaning the current oscillates at a rate of one cycle every 0.02s.
Within a digital clock, an intricate system of electronics reduces the AC frequency by a factor of 50, meaning the resultant current completes one full oscillation every second. By monitoring the fluctuation in electrical signal, the clock can keep time. Electrical oscillations aren’t plagued as heavily by frictional forces, making them considerably more accurate than mechanical clocks.
Crystal Time
Alternating currents are an effective way of keeping time digitally, however, if we wish to measure time periods with devices that aren’t permanently connected to mains electricity, such as mobile phones or laptops, we clearly have a problem.
Piezoelectric crystals are a class of materials that exhibit an electrical response to mechanical deformation. When squeezed, the microscopic electric fields of atoms within a piezoelectric crystal such as quartz will align to produce a net, macroscopic electric field. It turns out, this process also works in reverse, i.e. applying a voltage across the crystal causes a subsequent compression.

Applying such a voltage for a brief period of time will set the crystal into oscillation in a similar fashion as the simple pendulum. As the atoms within the crystal sway back and forth, the resultant piezoelectric response can be monitored as a fluctuating voltage similar to that from mains electricity.
The signal frequency is equal to the natural frequency of the crystal’s mechanical oscillations, around 30000Hz for quartz. Once again, a system of electronics reduces the frequency such that one cycle lasts precisely one second. The natural frequency of quartz is very well-defined and easy to control experimentally, making the piezoelectric clock orders of magnitude more accurate than its competitors.