system
Given the following post, respond as if you're commenting on Reddit:
human
How do computers keep track of time passing?

It just seems to me (from my two intro-level Java classes in undergrad) that keeping track of time should be difficult for a computer, but it's one of the most basic things they do and they don't need to be on the internet to do it. How do they pull that off?
gpt
The component that keeps track of the time in a computer is called the Real Time Clock (RTC). The RTC consist of a crystal that oscillates at a known frequency. In this case, 32768 Hz is often used, because it's exactly 2^(15) and that allows for convenient binary arithmetic. By counting the oscillations, the RTC can measure the passage of time.

In a regular computer, the RTC runs regardless of whether the computer is on or off with a small battery on the motherboard powering the RTC when the computer is off. When this battery runs out, the system can no longer keep track of the time when it's off and will reset the system time to a default value when it's started up.

RTCs are fairly accurate, deviating at most a few seconds per day. With internet connected devices, any deviation can be compensated for by correcting the RTC time with the time from a time server every now and then.