Fixing The Time on Slackware
For those who love their system's
uptime it is a sad moment when a power outage causes your system to go down after months or years. Worse still, on a reboot, you discover that your time is out by a hour, courtesy of daylight's saving time. Which is fine in itself, but it would be a better world if we all just used UTC. But that's another argument.
Slackware is, by definition slack. Not slack for its users mind you, but slack in terms of modifications. It's fairly quick if you know what you're doing and a learning experience if you don't. Both things are valuable, ergo it's a a good distribution. So, posting in hope that someone else might find this useful...
Mucking around with system-wide time is going to require privileged use. So use
su - to get into root.
The first thing you want to do is query the pool of ntp servers. Many people, myself included, uses the almost deprecated program nptdate. Try it by itself and you'll probably get a message similar to this...
root@isocracy:~# ntpdate 0.pool.ntp.org
23 Dec 08:06:36 ntpdate: the NTP socket is in use, exiting
Technically the ntpd program with the -q option acts in a similar manner. However, note the entry in the ntpd man page under the relevant section: ntpd will exit just after the first time the clock is set. This behavior mimics that of the ntpdate program, which is to be retired. Note the use of the future tense?
OK, so the socket is in use. That means that a NTP daemon is running. Which is usually good news if you want the time.
Tue Dec 23 08:06:55 AEDT 2014
Stop the daemon, the Slackware way.
root@isocracy:~# sh /etc/rc.d/rc.ntpd stop
Stopping NTP daemon...
Update from the pool, synchronize the hardware clock to the current system time as local time, restart the daemon, and check the date again.
root@isocracy:~# ntpdate pool.ntp.org
23 Dec 09:08:26 ntpdate: step time server 184.108.40.206 offset 3487.065561 sec
root@isocracy:~# hwclock --systohc --localtime
root@isocracy:~# sh /etc/rc.d/rc.ntpd start
Starting NTP daemon: /usr/sbin/ntpd -g
Saving system time to the hardware clock (localtime).
Tue Dec 23 09:09:06 AEDT 2014