LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Time woes (http://www.linuxquestions.org/questions/slackware-14/time-woes-4175445553/)

mutexe 01-14-2013 10:57 AM

Time woes
 
Morning,
I booted up my slack box for the first time in nearly 12 months today. Turns out the system time was completely screwed (thought it was 2005 for some reason).
I followed instructions on this website: http://pc-freak.net/blog/how-to-fix-...time-troubles/ which seemed to do the trick.
My question is: is this time discrepancy an artifact of me not switching on the machine enough or is there something I need to be doing like binding it to some sort of ntp server when the box boots up?
Many thanks in advance.
Tom

tronayne 01-14-2013 11:36 AM

Couple of things.

First one, you've most likely got a dead battery on the mother board, good idea to change it.

Second one, include a call to ntpdate in /etc/rc.d/rc.M before the call to start ntpd (that's after the network starts and additional filesystems are mounted).

You'd want to do something like
Code:

# Mount any additional filesystem types that haven't already been mounted:
mount -a -v 2> /dev/null | grep -v "already mounted"

# Start the Control Script for automounter:
if [ -x /etc/rc.d/rc.autofs ]; then
  sh /etc/rc.d/rc.autofs start
fi

# Set the time and date
/usr/sbin/ntpdate pool.ntp.org
sleep 1


# Start the Network Time Protocol daemon:
if [ -x /etc/rc.d/rc.ntpd ]; then
  sh /etc/rc.d/rc.ntpd start
fi

Given that the network is started, you can probably use pool.ntp.org, but it might be a good idea to try using an actual address (right now, pool.ntp.org is 108.61.56.35). Go to the NTP web site (http://www.ntp.org) and look through the addresses of stratum 2 servers and ping a few of them to pick one electrically close to you (you're looking for a low time value); use the actual address, not the name (like nnn.nn.nn.n).

Third option -- when you start the box, get into the bios and check and possibly set the time (especially with a dead battery).

Hope this helps some.

michaelk 01-14-2013 11:45 AM

Yes it is due to not being turned on and/or that you need to replace the BIOS battery. Hardware clocks are not very accurate and would expect it to drift if the computer has not been powered on for awhile. NTP will try to compensate for hardware clock drift but may not be enough if you are not going to power on the computer regularly.

mutexe 01-15-2013 02:15 AM

Cheers guys.
I'll pick up a new battery.


All times are GMT -5. The time now is 06:48 AM.