lichess.org
Donate
An electrical hazard warning sign overlayed over a sea of wooden analog clocks.

https://unsplash.com/photos/brown-and-white-clocks-FlHdnPO6dlw https://openclipart.org/detail/14427/signs-hazard-warning-electricity

A power surge fried my RTC

Off topic
The power went out. In the morning, my laptop was no longer able to keep time.

The hardware clock (RTC)

Modern computers can set the system time from the internet, and mine is no exception. However, when a computer is not connected to WiFi, it cannot update the time from the internet. Furthermore, when a computer is powered off or suspended, it is not possible to keep the system clock running without a special piece of hardware. This piece of hardware is called the hardware clock or real time clock (RTC).

The situation

The power had been going off and on last night and throughout the next day. In the morning, I noticed that my computer would no longer keep the correct time when suspended or powered off, instead reverting to the last time it was powered on. I knew what happened. There must have been a power surge after the power outage, possibly caused by the generators powering on, that damaged my RTC.

So what to do? Just use my watch from now on? What about file timestamps, git commit dates, email Date headers, etc. being wrong?

Attempted repair

Fortunately, I knew that the RTC generally has its own power supply: a small battery called the CMOS battery. So I opened up my laptop, disconnected both the main battery and CMOS battery, waited 5 minutes, plugged them back in and booted up. The first boot took a minute before it actually started booting, probably because it had to reinitialize BIOS data that had been reset when I disconnected the power. My laptop finally booted, but still had the wrong time. That is to be expected though, since I had just disconnected the CMOS battery.

Next, I ensured that the hardware clock had been set to the system time. Then I powered down, waited a minute, and powered back up. No luck. The hardware clock still wasn't working. I disconnected the main battery and CMOS battery again, but this time held the power button for 30 seconds to get rid of excess charge. I repeated the procedure. Still no dice.

Realization

Either the CMOS battery or my RTC was dead. I didn't have another CMOS battery handy, but I suspected that the problem was the RTC itself, not the battery. After all, I would think that of the two, the battery would be more resilient in a power surge. This is unfortunate, since I have never replaced an RTC nor did I know if it was even possible. I suspected I might have to replace the entire motherboard.

Unfortunately, I didn't know where to get a replacement motherboard for my laptop. Since I didn't even know if replacing the motherboard was necessary, I decided to contact tech support.

The twist

Tech support was very quick to respond. They said that the problem was in fact due to a leap year bug in the BIOS that had been reported just yesterday. Since it was already March 1st in UTC at that time, they suggested that I sync the correct time to the RTC and that should solve the issue. I ensured the hardware clock was synced, powered off, waited a minute or two, crossed my fingers, and powered back on.

Success! The hardware clock remained set, and the system time was correct.

Conclusion

It was a very unfortunate coincidence that the power went out on February 29th. Because of the power outage, I was almost certain that the issue was caused by a power surge. I didn't even consider the possibility of a BIOS bug. Had there not been a power outage, the problem still would've occurred and I likely would've considered a bug due to the fact that it was February 29th.