Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do computers keep track of time? [closed]

Tags:

How is time represented in the the computer? I mean doesn't the computer do all computations as fast as it can? How do you keep track of the passage of time if things run at various speeds on various machines?

like image 900
JacKeown Avatar asked May 02 '11 01:05

JacKeown


People also ask

How do computers count time?

Clock speed is measured by how many ticks per second the clock makes. The unit of measurement called a hertz (Hz), which is technically one cycle per second, is used to measure clock speed. In the case of computer clock speed, one hertz equals one tick per second.

How does a computer know how long 1 second is?

Basically, the computer has a "clock". This is a chip that generates a pulse every fixed period of time, say, every 1 millisecond, generated usually via a crystal. Counting second (or any long enough time) is now simple - the computer can count the number of "clock ticks" to estimate the time that has passed.

How does Windows keep track of time?

When you start Windows, it gains direct access to the memory of the Real Time Clock (RTC) and uses its date and time values to set the computer date and time. Timer interrupts maintain the computer time when Windows is running.

How accurate is the clock on my computer?

Unfortunately all the common clock hardware is not very accurate. This is simply because the frequency that makes time increase is never exactly right. Even an error of only 0.001% would make a clock be off by almost one second per day.


2 Answers

Computers keep track of time they same way you or I do - with a clock! The Real Time Clock runs even when the CPU is powered off. It's completely separate from the "clock cycles" of the CPU. On PCs, the clock runs on a battery when the computer is not plugged into an external power source.

like image 145
DaveGauer Avatar answered Oct 09 '22 15:10

DaveGauer


So basically what happens is computers, microwaves, etc. usually use what is known as a quartz timer. The reason they use quartz is because when you give quartz crystal an electric charge, it vibrates and sends a pulse back (piezoelectricity). And since the crystals can be so finely shaped and cut, people can predict exactly how many pulses it will give in a second. So then once the computer reads that X number of pulses have happened, 1 second should be displayed. It then resets and starts reading again continually. If they wanted to, and in most cases they do, a separate processor knows that 60 seconds make a minute, or 60 minutes to and hour, so it then would display that it has been a minute/hour, and reset it's second timer. So both of the two processors do very similar things but just with different scales.

like image 23
Y'all ready know Avatar answered Oct 09 '22 16:10

Y'all ready know