Generally there will be a special little battery on your main board to do that, at least that’s what a computer does. On your phone, if you unplug your main battery, and then turn it on (without WiFi or Cellular so it can’t get the time from the internet) will it have the correct time? If so, it has a clock battery. If not, it’s just using your regular battery.
Latest Answers