# If no server is found (Internet connection discarded) synchronizes it against itself!

server 127.0.0.1

driftfile /etc/ntp/drift
logfile /var/log/ntpd.log

# 'restrict 127.0.0.1 mask 255.0.0.0' provide your own computer with unlimited access
# 'restrict 192.168.12.32 mask 255.255.255.224' If you have a local network, and want other computers to be able to set their clock for your computer,
do the following. A good idea to reduce unnecessary Internet traffic. On the other computers, just enter the address of your computer in their 'ntpd.conf' file.
You can also sync your Windows XP. NOTE! Change the network / mask to match with yours..
# There are lots of flags, 'nomodefy' 'nomodefy' means that the other machines in the network can not
change your ntpd server. 'notrap' means they can not use your server for event logging
(can mean big load) 'Code' means that the server tries to kill enemy attacks
There is a lot of information on the Internet, for example:
# http://www.ece.udel.edu/~mills/ntp/html/accopt.html

restrict 127.0.0.1 mask 255.0.0.0

restrict 192.168.21.32 mask 255.255.255.224 nomodify notrap kod

In 'ntpd.conf' we referred to two files, now we have to create them, you do, for example, with the command$>touch /etc/ntp/drift

# settime
# Version 0.0.2
# Release date: 2006-11-10
# Updated: 2007-01-09
# Updated: 2015-07-16
# Copyright 2006-2015, Ingemar Ceicer.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.

# Add timehosts (2 or 3 would be sufficient). Select timehosts near your place.
# Here is the only place you need to change, add time servers according to the pattern you see below.
# Select any time-servers who are near your computer. Two or three is good enough
# time servers are almost never down.

Place the script (settime) in /usr/local/bin
Make it executable chmod +x /usr/local/bin/settime

To start the script when your Raspberry Pi 2 start

Edit /etc/rc.d/rc.local and add this to the file:

if [ -x /usr/local/bin/settime ]; then
/usr/local/bin/settime
fi

Logrotate

The log files grows and grows ... A good way to get reliable log files from the ntpd is to let the script 'logrotate' take care of the log files so that they do not grow uncontrollably.
By default Slackware logrotate every day at 04:40. Look in the folder '/etc/cron.daily'. There you will find the script 'logrotate'

What can there be in the configuration file?

An example:

/var/log/ntpd.log {
# Here we determine local, for ntpd.log specific rules.
daily # daily
rotate 7 # 7 files saved (ntpd.log.1, ntpd.log., 2 ...)
# 7 daily rotations means erasing. Change if you want!
notifempty # Does not rotate if the file is empty.
# ntpd can not close its log file, so the contents of the Old file is moved to a new one.
# Therefore, "copytruncate" may mean that something is lost.
copytruncate
}

/var/log/ntpusers.log {
daily
rotate 7
ifempty # Even if it is empty.
postrotate # Between "postrotate" and "endscript" says things that should be done after a # rotation has taken place.
# Here we use the program 'sed' to sort all the "ntpusers", ie the servers# you used and the clients that may have used your computer's clock
# to set the time. They are sorted according to the number of accesses they had.
ntpdc -c monlist \
| sed -n '3,${p;d;};w /var/log/ntpusers.log' \
| sort -k4nr >> /var/log/ntpusers.log
endscript
}

NOTE! Do not use the comments and beware of the tab and the space. logrotate is fussy!