K.Mandla's blog of Linux experiences

Using ntp for date correction

I have a tendency to slap things together the first time I try them, and not really take the time to work out how they’re supposed to be done, in the correct, classical *nix sense of things.

That’s the case too for this extremely old Pentium which has some of the worst clock lag I have ever seen on a computer. Over the course of a day (in other words, for every 24-hour span), the machine’s clock usually falls behind by at least a minute. The more I use it, the worse it gets, too. At one point, this machine lagged behind the others by as much as a day and a half. How embarrassing. :oops:

Personally I solved the problem in a way that’s probably less than ideal, but seems to be working. ntp from the contrib repo for Crux can sync the time with a remote server across a network, and without any configuration file editing or fancy footwork.

I inserted the ntp command into /etc/rc.local, and set it to sync against a distant server, and that way the clock is corrected each time the machine boots. ntp seems smart enough to wait for the network to be brought up (via /etc/rc.d/net) before doing its thing.

I read elsewhere that it’s possible to use ntp as a daemon and have it sync repeatedly while the machine is in use. To be honest, this machine has so little resources to work with that I’m not inclined to add something else to the mix. Once at startup gets me within striking distance of “correct,” and that’s good enough for now.

I suppose there is a better, or more orthodox way of setting up ntp, but for my purposes, this is satisfactory. Anyway, it keeps the clock from falling behind by days. :roll:

4 thoughts on “Using ntp for date correction”

PC clocks are notoriously bad at keeping time, as are any non-purpose-built electronic devices. All a PC cares about is its own clock cycles, not if said cycles fit into any greater scheme.That’s why all PC clocks will lag.