With an atomic clock, the resolution goes interestingly high and also the expected time to lose a second, in the order of million years. Well, if the inherent engineering functions correctly! Sometimes to see a clock doesn't look particularly special, but the one that it is at this link really is. The official US time is now also based on NIST-F2, an advanced atomic clock with solid accuracy.
A surprising resolution of this kind comes other time thanks to Nature and the people who discover properties and follow the steps to make it real. "Atoms that switch energy levels". The main culprits are an atom, now usually cesium 133, and microwave frequency. Lasers —semiconductors— also play a key role for creating the microwave beam. Cesium 133 atoms will absorb and emit a maximum of light if the microwave frequency matches a predefined tuning when hits them. Using this property, the clock is tuned thus the Cesium atoms will tick after a predefined number of sine waves —energy— in the beam, so the second can be divided by this total frequency, a bit more than 9 billion.
A good idea is to use at least two of them, because any element could experience a malfunction as they rely on machinery and circuits. Even if the resolution is exaggerated, when nobody would even think in maintaining a machine of this kind working during a million years, the process is very accurate and you could rely on these clocks during your life.
With multiple atoms and different properties, the future should raise multiple headlines about atomic clocks!
Simplifying the process to remember it better is this: when you apply energy to an atom, it will come a moment in which it emits a tick of energy, a bust of microwave radiation. It switches of energy level.