The console have a tiny chip in it called a Real Time Clock. It uses very little power and just keeps track of time. The power can come from the mains power through a tiny part of the power supply that never turns off. Or the power can come from a small battery. The battery have enough power to keep the RTC powered for years so even if you put your console in storage it will likely have the time of day fairly accurate when you start it up again.
Latest Answers