The oldest clocks were built in Egypt. Obelisks (3500 B.C) are the oldest clocks, whose moving shadows provided an easy way to follow the day.
All the clocks work following a similar process, which counts a regular cycle measuring the time in that way. In other words, the measurement of the time is carried out comparing a fixed event with another unknown one.
In ancient times, natural events were used as "datum point" for the measurement of time, for example, the length of the day or the observation of the stars. The time measurement was not always destined to determine the hour of the day, sometimes this measurement just showed certain events that were interesting for our ancestors, like the solstices (e.g.:Stonehenge)
Other clocks used mechanisms with a constant length instead of paying attention to an external event. The Egyptians about 1400 years B.C., developed the first instrument of this type, the clepsydra or water clock, which in its simplest form consisted of an alabaster bowl, wide at the top and narrow at the bottom, marked on the inside with horizontal "hours" or marks. The Chinese or Hindus improved this mechanism later on. These types of clocks have been used for centuries.
In addition to the clepsydras, the Egyptians in the VIII century B.C used sun clocks.
Other civilizations used simple objects with ingenious forms to measure the time, for example, the Chinese civilization burned an evenly tied cord and measured the time interval that the fire needed to travel from a knot to the following one.
The first mechanical clocks were probably built around the 14th century, at the time they were quite inaccurate and huge compared to the current ones. The first references to this kind of clocks are found in books by Alfonso X. Later on, great characters like Leonardo Da Vinci contributed to the development of ingenious apparatus which were able to measure the time more accurately. The first engine clocks were based on the use of weights. The invention of the wharf engine, in the XV century, made possible the development of portable clocks.
A further development came with the creation of the pendular clock, whose principle was conceived by Galileo. It was Huygens, a Dutch scientist, who built it in 1656 though. This type of clock was a huge improvement compared to the previous ones, since the loss of synchronization that it had after one day was only ten seconds. During the XVII century, the first pocket clocks appeared. The pendulum clock was improved during almost three centuries, until 1929, when an American scientist, Warren A. Marrison,
developed the quartz-crystal clock, whose operation is based on the vibration that experiences the crystal when an alternating electric voltage is applied to it. Nowadays a high-quality quartz clock is out of phase a millisecond every month, if we consider a lower quality one, this loss of accuracy will happen in a few days or even more often. These estimates are done under optimum conditions, nevertheless, the aging of the crystal, the dirt and other agents can frequently harm the precision of these mechanisms.
In the middle of the last century, in 1949, the first atomic clock, based on the natural frequency of atomic particles was created, its precision was not much better than the one of the quartz clocks at the moment, nevertheless, eventually the use of other atoms have made possible the development of atomic clocks of extraordinary accuracy, even when they were created using the same process. The most common example is the cesium atomic clock,
with an extraordinary precision (would approximately be out of phase a millisecond in 1400 years). The rubidium resonator, which has a lower quality than the cesium resonator, is nevertheless important because it is relatively inexpensive compared to cesium resonators and is out of phase approximately a millisecond in several months which is more than adequate for most needs.