eli5: How do you tell a computer what time it is? You can tell a mechanical clock to tick every second using physics but how do you do the same to a non-moving electronic device?

1.11K views

eli5: How do you tell a computer what time it is? You can tell a mechanical clock to tick every second using physics but how do you do the same to a non-moving electronic device?

In: Technology

5 Answers

Anonymous 0 Comments

You have two main ways of doing it. Quartz crystals vibrate at a specific frequency so can be used to measure time. This is especially common in the likes of wrist watches.

The other main method is to use the mains AC frequency which in the UK is 50hz. This is mostly the likes of beside clocks, less so in computers because they tend to rely on DC current past the power supply block.

Notably however most computers don’t *need* to keep good time as they can use NTP (Network Time Protocol) to sync their clocks to a known source over the internet. Other devices can also sync time through GPS which uses a hyper accurate time stamp as a means of determining location.

Anonymous 0 Comments

Well. The computer has an internal clock. With a small battery attached to it. That helps not just with keeping time, but also keeping track of basic settings like how many hard drives are installed and stuff like that.

But if the battery runs out, the computer will naturally fail to keep time.

And if you tell the computer that “nuhuh, actually. It’s not 2020-02-16 today, it’s actually 1994-02-07” it is going to believe you and go with that.

But that is for obvious reasons not really the most convenient way to do it. Because poor timekeeping is one of the main reasons that you don’t find your files when you look for them. And it makes any security audit near-useless, or at least excessively time consuming.

So, to work around that, all reasonably modern operating systems that has popped up in the era where most computers are assumed to have permanent internet access, nearly all operating systems have functionality where they at regular intervals contact a network time server and asks for the correct time.

NTP (the Network Time Protocol) does a lot of fiddly and neat things to take connection latency into account to get a time that is as accurate as possible. But it sort of comes with the concept that even if the computer clock runs two seconds late, it’s an extreme improvement to not really being sure what decade it is.

Anonymous 0 Comments

A real time clock in a computer is usually a battery powered counting device. What it counts are vibrators of a quartz crystal, which occur at a set speed.

The computer software then is told, either by a server or human input, what time it is, and it counts up the time from there.

Since the clock is counting, even when the system is powered off, it can adjust the system clocks to the correct time when it powers back on.

Anonymous 0 Comments

Inside every digital clock is a crystal that physically resonates like a tuning fork when it is excited by electric pulses. This resonance can also generate electricity, so when the crystal reaches its resonant frequency it affects the circuit driving it and syncs up the electric waveform to its ringing. The circuit can then count the cycles of this waveform – each X cycles one second passes.

Crystals are usually 25 to 5 ppm (parts per million) accurate, so you’d get some drift, but the computer sync up its own idea of what time it is to time services through the internet. Those use much more accurate atomic clocks.

Anonymous 0 Comments

You do it with a quartz, which emits a pulse at specific intervals when a certain voltage passes through it.