There are two main ways of measuring time: dynamic and atomic time. The former relies on the motion of celestial bodies (including the Earth) to keep track of time, whether it’s the rotation time of a distant spinning star such as a pulsar, the motion of a star across our night sky or the rotation of the Earth. However, a spinning star not withstanding (which can be hard to observe), these methods are not always entirely accurate.
The old definition of a second was based on the rotation of the Earth. As it takes the Sun one day to rise in the east, set in the west and rise again, a day was almost arbitrarily divided into 24 hours, the hour into 60 minutes, and the minute into 60 seconds. However, the Earth doesn’t rotate uniformly. In fact, it’s rotation decreases at a rate of about 20 millionths of a second every calendar year due to tidal friction caused by the Moon.
Atomic time relies on the energy transition with an atom of a certain element, commonly caesium. By defining a second as the number of these transitions (where an electron ‘quantum jumps’ between shells in an atom after gaining or losing a specific amount of energy), time can be so accurately measured that only a tiny portion of a second is lost every million years. The definition of a second is currently defined as 9,192,631,770 transitions within a caesium atom.