How do computers keep time correctly?

aytec
3 min readMay 20, 2020

--

Have you ever thought about how computers keep time? Or, how stopwatch of different smartphones can count 10 seconds equally?. Isn’t it very mysterious that your computer or your smart phones can still know the time very correctly even if they are completely turned off for a long time?

I will try to explain this mechanism in a very simple way.

Guess what? There is a clock in the computers. It is this simple. If this information is enough for you, then you don’t need to read the remaining of the blog. If you wonder more, keep reading.

Motherboard

As you know (if you are not a caveman or cavewoman), there is a motherboard on the computers. (Yes. You right! Why not fatherboard? Another sexism in science…) See. There is a clock on this board.

This clock is not an ordinary clock. It does not have a hour hand. It is called as System Clock.

A system clock, or we can also call system timer, is a continuous oscillation that helps the computer keep the correct time. It counts the number of seconds elapsed since the epoch, and uses that data to calculate the current date and time.

Yeah I can hear you say “wait, but how does it count?”.

Are you read to solve the mystery? The answer is quite simple.

→ Quartz crystals.

Quartz Crystals

As I mentioned above, the system timer counts the number of something, thereby we know the time. But the question is, how much is it counting?

→ 32,768

What? Where did this number come from? Let’s go back to Quartz.

Quartz is a hard, crystalline mineral composed of silicon and oxygen atoms. It is one of the most common minerals on Earth. Quartz is what we call piezoelectric, meaning when compressed, it generates a small but measurable electrical current. In other words, when electricity passes through quartz, it vibrates at a precise frequency — an exact number of times per second.

Quartz vibration

It looks like a musician’s tuning fork, right? And there is an independent battery in the motherboard so that even if you completely turned off (unplug) your computer and your smartphone, or when the battery of your smartphone is out, this independent battery is still be able to feed the clock. The battery inside a quartz clock sends electricity to the quartz crystal via an electronic circuit, causing the fork’s prongs to vibrate 32,768 times per second.

The circuit measures the number of vibrations (do not think how it counts, it is out of our topic.. believe me), and generates one electronic pulse per every 32,768 vibrations — or, one per second. Quartz movements are both accurate and durable.

Now you are enlightened.. When your friends asked what the value of 1 second is, you can say 32,768 vibrations of quartz crystals and make your friends a bit shell shocked.

You can still have questions in your mind like who did decide that 1 second would be 1 second? That’s not my problem. (Read this if you are really consumed with the time and clocks or see the doctor.)

Here is a final question for you. What would you say if you were asked to determine the duration of 1 second?

Mischief managed.

--

--

aytec
aytec

Written by aytec

A software engineer in Berlin, with a passion for computer science.

No responses yet