Show time on software clock: date
Set time on software clock: date -s "2 OCT 2006 18:00:00"
Sync software clock to hardware clock: hwclock --systohc
Sync software clock to hardware clock on shutdown:
- Add CLOCK_SYSTOHC="yes" to /etc/conf.d/clock
Setup NTP:
- echo "net-misc/ntp caps" >> /etc/portage/package.use
- emerge -av ntp
- Manual time sync can be done with ntpdate:
- Run ntpdate [server] #only works if ntpd isn't running. If you are running ntpd, you don't need to run ntpdate.
- You can have it run on boot:
- Put NTPCLIENT_OPTS="-b -u firstserver secondserver thirdserver" in /etc/conf.d/ntp-client
- To have safe placement in the startup sequence, add a line of after net.eth0 after the line of "need net" in /etc/init.d/ntp-client
- To be extra safe, you can add the following to /etc/conf.d/net:
postup() {
if [[ "${IFACE}" == "eth0" ]] ; then
# Wait for connection to be ready to communicate
sleep 5
fi
return 0
} - Then make it start on boot:
- /etc/init.d/ntp-client start
- rc-update add ntp-client default
- Run ntpdate [server] #only works if ntpd isn't running. If you are running ntpd, you don't need to run ntpdate.
- Continuous sync can be done with ntpd:
- Configure it by editing /etc/ntp.conf
- Start it: /etc/init.d/ntpd start
- Make it start on boot: rc-update add ntpd default
- Checking it's sync status... "It may take up to 4 hours of semi-continuous reachability to calibrate the clock before you achieve stratum 3 status. If the stratum status hasn't changed in a few hours, your synchronization is definitely failing. It should settle at 3, from synchronization with stratum 2 servers."
- ntpq -c readvar | grep stratum # Using full name of option
- ntpq -c rv | grep stratum # Using abbreviation
- ntpq -c pe #check what peers you are connected to (and in turn what they are connected to
- ntpq -c rv #For some more information