Home » Questions » Computers [ Ask a new question ]

Netbook keeps losing time

Netbook keeps losing time

I own a Lenovo S10 and it runs Arch Linux as the only OS. For some odd reason which I still haven't been able to figure out, it keeps losing the time. In the BIOS is has the right settings though.

Asked by: Guest | Views: 220
Total answers/comments: 4
Guest [Entry]

"Make sure your NTP client also sets the hardware clock (through the BIOS), and not just the Linux software clock.

You can check your hardware clock using the hwclock program (located in /usr/sbin or /sbin) and compare it to the software clock using the date command.

Boring explanation:

Your computer has a small chip in it, which is called ""the real-time clock"" or RTC. This clock runs on a battery, and counts time just like a wrist-watch. When the computer goes on, the clock is read, and that's how your operating system knows what time it is when it starts up. But after that first read, the operating systems doesn't have to use the RTC - it can simply continue counting time (seconds, hours and whatever) by itself. Whenever the user asks what time its, it can simply report its own time (instead of the time that the RTC reports).

The tricky bit comes when the RTC doesn't have the right time. When you try to correct the clock, it's really the operating system that does that for you. The operating system may only update its internal, software, clock. In that case, once you reboot the incorrect time will be loaded again from the RTC. I still remember this from the DOS days. You had to go into the BIOS to change the clock. ugh.

Anyway, the final nail in the coffin is this: the time read from the RTC is just a number. And the operating system is allowed to change that number. For example, it might want to add 3,600,000 milliseconds (1 hour) to that number, so that GMT+1 users feel comfortable. Other times, there's something screwy with the timezone settings.

Either way, setting the hardware clock from within the operating system tends to fix this, since it goes through the same filtering process. So even if your OS adds 5 minutes to the RTC, it will also subtract 5 minutes before updating the RTC.

Good luck!"
Guest [Entry]

"It sounds like the battery that keeps the clock running is dead. I have a feeling that if you replace the battery the time will keep when it is turned off.

Since you mentioned in the comment that the bios has the correct time, it could be a processor issue, which also makes sense. The timing on the processor is different when you have it plugged into the wall and when you don't. It could be that if you are on battery a second isn't calculated in the same way because the processor's ticks are different. If it is still under warranty I would give support a call and ask."
Guest [Entry]

"I have tried using NTP and while it fixes the problem temporarily, it is not always an option since its not always connected to the internet.

NTP will do two things. The first is continually compare your time with network time servers, and adjust as necessary.

The second thing NTP will do is calculate an accurate drift for your system clock. So even when you're not connected, NTP can still keep adjusting your clock. It won't be as accurate as when you're online, but will be better than nothing. I'm not sure how it will adjust after your netbook has been powered off for a while. Running ntpdate as part of the startup will set the correct time if you have an internet connection."
Guest [Entry]

"I've had similar problem on my laptop with Archlinux.
This thread helped."