Many of you may already know the answer to the second question: the motherboard has a small battery, among other things, that allows the computer to continue counting time and keep up with time. However, that stack is no longer important in today's PCs, because PCs know what time it is in other ways, which we'll tell you below.
How does your PC know what time it is?
It is possible that when you buy a computer and turn it on for the first time, it will show you the right time, even if you bought it together. This is because most of today's operating system – be it Windows, Linux or Mac OS – Use the Internet to synchronize with the time server
For example, the Windows 10 clock uses a Spanish NTP Stratum 1 time server (if you live in another country, it might be using another server but because they are all compatible with another, it is not important). These servers use it cesium atomic clocks time-tracking, and they are very accurate because they do not use moving parts that are out of sync, making them extremely reliable where available. As you may be curious, the unit of time is defined by 9,192,631,770 cesium cycles, which means these clocks use the same technology that science uses to explain the second one.
For very modern computers this goes a long way, and that's it even BIOS is able to connect to the Internet and synchronize time, so they know it even before you install the app.
How does the PC remember time even when turned off?
All of this is okay and okay, but let's look at a specific situation. Suppose you lost your Internet connection, which means your PC will no longer be able to synchronize time, so you're crazy to turn off your PC. The next morning, you don't have Internet but when you turn on your PC, you check whether it continues to show time well; How can this be? How can a PC know what time it is?
This is because with or without synchronization with Internet time servers, the PC is able to remember and track time itself. In fact, you can see the power of your PC to remember time in UEFI / BIOS, since this is preloaded before starting the application.
Inside all computers there is an internal clock, and if you turn off and unplug the PC from the mines it will still be a while. This is, as you already know, because motherboards have a small 3V battery that powers the CMOS chip, which handles keeping the clock on – for some things – even if the other PC is powerless.
These batteries have a lifespan of around 10 years (so you rarely change them), but they can still cause problems. If you get "CMOS error" when starting your PC or the time is not correctly displayed, it may mean that it is running out and that you will need to change it or the CMOS chip is damaged.
In any case, even if you did not have a battery on the motherboard (it will give you an error when you start) the PC will still know how long you have connected it to the Internet, since it does not need to synchronize with Internet servers that. let you know the time.