23
\$\begingroup\$

There's laptops, PCs, microcontrollers and a lot of other things that can be plugged out and plugged in without a battery. But how does the system clock still keep track of time without anything to power it?

\$\endgroup\$
2
  • 5
    \$\begingroup\$ -1 for thinking that a device can work without a power source. You should have asked what is the power source. \$\endgroup\$ Oct 3, 2015 at 9:28
  • 11
    \$\begingroup\$ @QuoraFeans I don't see any assumption that the device can work without a power source. I understand the question to be asking "when I plug it back in after it's been unplugged for a while, it has the right time. how does it do this?". \$\endgroup\$
    – Don Hatch
    Oct 4, 2015 at 0:10

5 Answers 5

50
\$\begingroup\$

They use a small backup battery, which you can read about on Wikipedia:

Modern personal computer motherboards have a backup battery to run the real-time clock circuit and retain configuration memory while the system is turned off.

In computers this is usually called the "BIOS battery" and is generally a lithium cell such as a CR2032. In the photo below it is circled in red:

BIOS backup battery

This is the same for portable devices which have their own battery, for example a laptop. You can prove this by removing the internal battery and seeing if it keeps the time.

So to answer your question they don't really keep time without power, they have a battery for it.

\$\endgroup\$
5
  • 9
    \$\begingroup\$ And when that battery goes dead, very strange things can happen. I got a "broken computer" from someone I knew once after they bought a new one because they were tired of trying to get it to work... It cost me $2 for a new battery, and it worked great for years. They never knew the computer had a battery. \$\endgroup\$
    – JPhi1618
    Oct 2, 2015 at 15:50
  • 4
    \$\begingroup\$ It's not always a battery. My digital camera has a capacitor that can keep the clock running for a week or two, more than enough time for me to change the batteries. \$\endgroup\$
    – Mark
    Oct 2, 2015 at 21:51
  • 3
    \$\begingroup\$ @JPhi1618 People just aren't comfortable with opening up computers. It's amazing how many "slow" or "broken" computers can be fixed by simply blowing dust off the CPU fan. \$\endgroup\$ Oct 2, 2015 at 22:03
  • 1
    \$\begingroup\$ Second the bit about laptops. I've got an old one here, it works but the CMOS battery is dead--it won't keep time anymore. It's a $2 fix--if I could find the stupid battery. Even the repair manual doesn't say where it is hiding. \$\endgroup\$ Oct 3, 2015 at 4:35
  • \$\begingroup\$ Also many motherboards just refuse to let you into the BIOS settings if the battery is dead,but would otherwise allow you to start the computer just fine. \$\endgroup\$
    – vsz
    Oct 4, 2015 at 18:55
30
\$\begingroup\$

Modern equipment often uses ultra-capacitors to keep real-time clock powered when the system is off:

enter image description here

This is a typical solution for most mobile phones which are almost constantly powered and only need the back-up power when the user removes the battery.

\$\endgroup\$
13
  • 1
    \$\begingroup\$ Do iOS and Android smartphones have something like this? \$\endgroup\$
    – voices
    Oct 4, 2015 at 11:54
  • 1
    \$\begingroup\$ @RozzA: I don't really know what you're talking about. I think you're making a few incorrect assumptions about my simple query. \$\endgroup\$
    – voices
    Oct 5, 2015 at 12:31
  • 1
    \$\begingroup\$ @MSalters So that if you travel someplace with no network coverage, you'll get your alarm in the morning and don't miss your bus go get out of the creepy place. \$\endgroup\$ Oct 5, 2015 at 12:31
  • 1
    \$\begingroup\$ @DmitryGrigoryev: You'd need a proper battery for that anyway, an ultracap won't do. The ultracap generally is there just to cover a short loss of primary power. But why save the RTC when temporarily removing a phone's battery? You'll just grab the network time when the battery is reinserted. \$\endgroup\$
    – MSalters
    Oct 5, 2015 at 12:37
  • 1
    \$\begingroup\$ @MSalters but what if you remove your battery when in an out-of-coverage region? \$\endgroup\$ Oct 5, 2015 at 12:40
27
\$\begingroup\$

While the other answers are definitely true: electronic devices cannot keep track of time without a power source, there are other considerations that can give the illusion of keeping track of time:

  • connected devices ask for a time synchronisation as soon as they connect: computer usually gets it from the internet using NTP (network time protocol), GSM devices can also get it from their local cell tower.
  • there are multiple services broadcasting time over the air waves: GPS is just a worldwide broadcasting system of an incredibly precise time. there are AM radio stations whose sole purpose is to broadcast their current time
  • finally some smaller systems (microcontroller and embedded systems) do not really need an accurate time, just guarantee that time always flows in the same direction. They would save their timestamp every now and then in a permanent memory area and restart from their last known time on next start.

NTP is defined by RFC 5905

Single transmitter radio clock

\$\endgroup\$
2
  • 7
    \$\begingroup\$ It's not a good idea to write "the above answers" because the order could change as people vote on them. Your answer is currently the newest but no longer the last one on the page. \$\endgroup\$
    – CJ Dennis
    Oct 3, 2015 at 4:37
  • \$\begingroup\$ As a practical example of the first: that is exactly what the Raspberry Pi does. \$\endgroup\$
    – Martijn
    Oct 5, 2015 at 12:56
3
\$\begingroup\$

Without a power source an electronic device can't keep track of time. Batteries are power sources so they can't be thought of as being able to keep time without power.

There is another strategy that doesn't keep track of time. When you 'sync' your device with the computer time on the device is synchronized.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Or from GPS, or from the phone network. \$\endgroup\$
    – David
    Oct 2, 2015 at 16:29
  • \$\begingroup\$ Or any other time source. \$\endgroup\$ Oct 3, 2015 at 16:35
  • \$\begingroup\$ @LightnessRacesinOrbit like the user \$\endgroup\$ Oct 3, 2015 at 17:48
2
\$\begingroup\$

Besides the "big flat battery on a computer motherboard", there is another device other answers don't mention: the RTC (real time clock).

Some microcontrollers do have such a feature, by having an internal battery inside the chip, which can keep the time for decades without external power.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Can you include some detail about microcontrollers with an internal battery? Many have pins for a separate external source (e.g. supercap or battery) but I've never seen one with a battery "inside the chip". \$\endgroup\$
    – David
    Oct 4, 2015 at 20:17
  • 3
    \$\begingroup\$ st.com/web/catalog/sense_power/FM151/CL1410/SC403/… \$\endgroup\$
    – oakad
    Oct 5, 2015 at 0:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.