====== Network Time Protokol NTP ==
This is a description how to setup your computer in order to fetch the accurate time from the internet. --- 2004-11-26, 2006-12-14, 2012-05-05;
Infos taken from: [[http://www.pool.ntp.org/use.html|How do I use pool.ntp.org?]], [[http://support.ntp.org/bin/view/Servers/NTPPoolServers|Pool Servers]] ([[http://www.edafe.org/slackware/|Time Synchronisation with NTP]] & [[http://www.ntp.org/ntpfaq/|NTP FAQ and HOWTO]])
In ''/etc/ntp.conf'' uncomment the line
#server pool.ntp.org
and add your appropriate sub-zone, eg:
server de.pool.ntp.org
If, contrary to expectations, you have servers which do not use version 4, but the older version 3 of the NTP-protocol, add 'version 3' after the server entry, eg: ''server timesource.kaeser-net.de version 3''. [[http://www.eecis.udel.edu/~mills/ntp/html/confopt.html|More]]
To manually adjust your computer clock from time to time, just issue the command ''ntpd -q'' from now on :?:
Make ''/etc/rc.d/rc.ntpd'' runnable and start it with ''''/etc/rc.d/rc.ntpd start''
After some time (this could take as long as half an hour!), ntpq -p should output something like:
remote refid st t when poll reach delay offset jitter
==============================================================================
+81.6.42.224 193.5.216.14 2 u 68 1024 377 158.995 51.220 50.287
*217.162.232.173 130.149.17.8 2 u 191 1024 176 79.245 3.589 27.454
-129.132.57.95 131.188.3.222 3 u 766 1024 377 22.302 -2.928 0.508
The IP addresses will be different, because you've been assigned random timeservers. The essential thing is that one of the lines starts with an asterisk (*), this means your computer gets the time from the internet.
===== Attic ==
==== With temporary Connection (Modem) ==
Add this code to the file /etc/ppp/ip-up. Create it, if it not exists and make it runnable.
#!/bin/bash
# /etc/ppp/ip-up
spd=$((24*60*60)) # seconds per day ; #spd=5 # test
today=$(($(date +%s) / spd)) # today in days since 1970
last=$(($(stat -c%Y $0) / spd)) # last setting of time in days since 1970
if ((today>last)); then # fetch the time once a day:
if ntpd -q; then
touch $0 # remember time setting in the modification time stamp of this file
logger "Time set successfully"
else
logger "ntpd error while setting time!"
fi
else
logger "No need to set time yet"
fi
:!: On my pppoe DSL connection it doesn't work!