25

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?

Loogai
  • 399
  • 1
  • 3
  • 5
  • 6
    -1 for thinking that a device can work without a power source. You should have asked what is the power source. – Quora Feans Oct 03 '15 at 09:28
  • 11
    @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?". – Don Hatch Oct 04 '15 at 00:10

5 Answers5

51

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.

David
  • 4,504
  • 2
  • 25
  • 44
  • 9
    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. – JPhi1618 Oct 02 '15 at 15:50
  • 4
    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. – Mark Oct 02 '15 at 21:51
  • 3
    @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. – Dmitry Grigoryev Oct 02 '15 at 22:03
  • 1
    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. – Loren Pechtel Oct 03 '15 at 04:35
  • 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. – vsz Oct 04 '15 at 18:55
30

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.

Dmitry Grigoryev
  • 25,576
  • 5
  • 45
  • 106
  • 1
    Do iOS and Android smartphones have something like this? – voices Oct 04 '15 at 11:54
  • @tjt263 why would the software OS make a difference?? – RozzA Oct 04 '15 at 20:58
  • @tjt263 Most probably yes. Notice the difference in size between the battery from David's answer and the ultracap above? I'd say both are quite typical. Smaller batteries will have shorter lifespan, while smaller ultracaps will last just as long, only the amount of power back-up time will be reduced. – Dmitry Grigoryev Oct 05 '15 at 07:05
  • Why would a mobile phone need to keep its RTC powered? It can grab the network time when powering up. – MSalters Oct 05 '15 at 12:15
  • 1
    @RozzA: I don't really know what you're talking about. I think you're making a few incorrect assumptions about my simple query. – voices Oct 05 '15 at 12:31
  • 1
    @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. – Dmitry Grigoryev Oct 05 '15 at 12:31
  • 1
    @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. – MSalters Oct 05 '15 at 12:37
  • 1
    @MSalters but what if you remove your battery when in an out-of-coverage region? – Paŭlo Ebermann Oct 05 '15 at 12:40
  • @DmitryGrigoryev Yeah I have pulled a few iPhones apart and never noticed any additional batteries etc on the circuit board. Would either of these backup power sources be strong enough to operate any additional features of the device? Particularly involving cell tower communication? That could have some interesting implications. – voices Oct 05 '15 at 12:41
  • Smartphones normally just use the primary battery, and are never fully off. If you remove your battery (which you can't do on an iPhone, of course) while out of coverage you lose the time. Cell tower communication requires quite a lot of power and a battery or capacitor of noticeable size. – pjc50 Oct 05 '15 at 12:41
  • @pjc50 They can be removed. They aren't soldered in or anything. But yeah, I see what you mean. – voices Oct 05 '15 at 12:44
  • @PaŭloEbermann: Then you lose the RTC until you get coverage again. It's a reasonable tradeoff. Look at the picture; that ultracap is big (by mobile phone standards). It's also a bit pricey. – MSalters Oct 05 '15 at 12:46
  • @MSalters SIM card removal for instance. Also, consider non-network connected devices that use similar hardware, like iPods and iPads etc. – voices Oct 05 '15 at 12:47
28

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

Philippe
  • 281
  • 2
  • 2
  • 8
    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. – CJ Dennis Oct 03 '15 at 04:37
  • As a practical example of the first: that is exactly what the Raspberry Pi does. – Martijn Oct 05 '15 at 12:56
3

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.

user94592
  • 31
  • 1
2

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.

vsz
  • 2,554
  • 1
  • 17
  • 32
  • 2
    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". – David Oct 04 '15 at 20:17
  • 3
    http://www.st.com/web/catalog/sense_power/FM151/CL1410/SC403/PF147883?sc=internet/analog/product/147883.jsp – oakad Oct 05 '15 at 00:21