summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FAQ691
-rw-r--r--INSTALL184
-rw-r--r--Makefile.in48
-rw-r--r--NEWS29
-rw-r--r--README16
-rw-r--r--candm.h9
-rw-r--r--chrony.conf.5.in67
-rw-r--r--chrony.texi.in5216
-rw-r--r--chronyc.1.in74
-rw-r--r--chronyd.8.in166
-rw-r--r--client.c926
-rw-r--r--cmdmon.c74
-rw-r--r--cmdparse.c37
-rw-r--r--cmdparse.h3
-rw-r--r--conf.c25
-rw-r--r--conf.h3
-rwxr-xr-xconfigure12
-rw-r--r--doc/Makefile.in72
-rw-r--r--doc/chrony.conf.adoc2108
-rw-r--r--doc/chrony.conf.man.in3432
-rw-r--r--doc/chronyc.adoc1126
-rw-r--r--doc/chronyc.man.in1771
-rw-r--r--doc/chronyd.adoc164
-rw-r--r--doc/chronyd.man.in183
-rw-r--r--doc/faq.adoc404
-rw-r--r--doc/installation.adoc189
-rw-r--r--examples/chrony.spec14
-rw-r--r--local.c16
-rw-r--r--ntp.h6
-rw-r--r--ntp_core.c45
-rw-r--r--ntp_core.h2
-rw-r--r--ntp_io.c16
-rw-r--r--ntp_sources.c75
-rw-r--r--ntp_sources.h3
-rw-r--r--pktlength.c3
-rw-r--r--refclock.c23
-rw-r--r--reference.c106
-rw-r--r--reference.h6
-rw-r--r--reports.h5
-rw-r--r--sched.c7
-rw-r--r--sources.c63
-rw-r--r--stubs.c6
-rw-r--r--sys_linux.c1
-rwxr-xr-xtest/simulation/105-ntpauth47
-rwxr-xr-xtest/simulation/110-chronyc4
-rwxr-xr-xtest/simulation/115-cmdmontime4
-rwxr-xr-xtest/simulation/121-orphan23
-rw-r--r--test/unit/Makefile.in3
-rw-r--r--util.c13
-rw-r--r--version.txt2
50 files changed, 10970 insertions, 6552 deletions
diff --git a/FAQ b/FAQ
index 22ed4a4..cd76bf8 100644
--- a/FAQ
+++ b/FAQ
@@ -1,388 +1,409 @@
- Frequently Asked Questions
- __________________________________________________________________
+Frequently Asked Questions
+
+Table of Contents
+
+ o 1. chrony compared to other programs
+ ? 1.1. How does chrony compare to ntpd?
+ o 2. Configuration issues
+ ? 2.1. What is the minimum recommended configuration for an NTP client?
+ ? 2.2. How do I make an NTP server from an NTP client?
+ ? 2.3. I have several computers on a LAN. Should be all clients of an
+ external server?
+ ? 2.4. Must I specify servers by IP address if DNS is not available on
+ chronyd start?
+ ? 2.5. How can I make chronyd more secure?
+ ? 2.6. How can I improve the accuracy of the system clock with NTP
+ sources?
+ ? 2.7. What happened to the commandkey and generatecommandkey directives?
+ o 3. Computer is not synchronising
+ ? 3.1. Behind a firewall?
+ ? 3.2. Are NTP servers specified with the offline option?
+ ? 3.3. Is chronyd allowed to step the system clock?
+ o 4. Issues with chronyc
+ ? 4.1. I keep getting the error 506 Cannot talk to daemon
+ ? 4.2. I keep getting the error 501 Not authorised
+ ? 4.3. Why does chronyc tracking always print an IPv4 address as
+ reference ID?
+ ? 4.4. Is the chronyc / chronyd protocol documented anywhere?
+ o 5. Real-time clock issues
+ ? 5.1. What is the real-time clock (RTC)?
+ ? 5.2. I want to use chronyd's RTC support. Must I disable hwclock?
+ ? 5.3. I just keep getting the 513 RTC driver not running message
+ ? 5.4. I get Could not open /dev/rtc, Device or resource busy in my
+ syslog file
+ o 6. NTP-specific issues
+ ? 6.1. Can chronyd be driven from broadcast NTP servers?
+ ? 6.2. Can chronyd transmit broadcast NTP packets?
+ ? 6.3. Can chronyd keep the system clock a fixed offset away from real
+ time?
+ ? 6.4. What happens if the network connection is dropped without using
+ chronyc's offline command first?
+ o 7. Operating systems
+ ? 7.1. Does chrony support Windows?
+ ? 7.2. Are there any plans to support Windows?
1. chrony compared to other programs
- 1.1. How does chrony compare to ntpd?
-
- chronyd was designed to work well in a wide range of conditions and it
- can usually synchronise the system clock faster and with better time
- accuracy. It doesn’t implement some of the less useful NTP modes like
- broadcast client or multicast server/client.
-
- For a more detailed comparison of features and performance, see the
- [1]comparison page on the chrony website and the [2]Comparison with
- ntpd section in the manual.
-
- If your computer is connected to the internet only for few minutes at a
- time, the network connection is often congested, you turn your computer
- off or suspend it frequently, the clock is not very stable (e.g. there
- are rapid changes in the temperature or it’s a virtual machine), or you
- want to use NTP on an isolated network with no hardware reference
- clocks in sight, chrony will probably work much better for you.
-
- The original reason chrony was written was that ntpd (called xntpd at
- the time) could not to do anything sensible on a PC which was connected
- to the 'net only for about 5 minutes once or twice a day, mainly to
- upload/download email and news. The requirements were
- * slew the time to correct it when going online and NTP servers
- become visible
- * determine the rate at which the computer gains or loses time and
- use this information to keep it reasonably correct between connects
- to the 'net. This has to be done using a method that does not care
- about the intermittent availability of the references or the fact
- the computer is turned off between groups of measurements.
- * maintain the time across reboots, by working out the error and
- drift rate of the computer’s real-time clock and using this
- information to set the system clock correctly at boot up.
-
- Also, when working with isolated networks with no true time references
- at all ntpd was found to give no help with managing the local clock’s
- gain/loss rate on the NTP master node (which was set from watch). Some
- automated support was added to chrony to deal with this.
- __________________________________________________________________
+1.1. How does chrony compare to ntpd?
+
+chronyd was designed to work well in a wide range of conditions and it can
+usually synchronise the system clock faster and with better time accuracy. It
+doesn't implement some of the less useful NTP modes like broadcast client or
+multicast server/client.
+
+If your computer is connected to the Internet only for few minutes at a time,
+the network connection is often congested, you turn your computer off or
+suspend it frequently, the clock is not very stable (e.g. there are rapid
+changes in the temperature or it's a virtual machine), or you want to use NTP
+on an isolated network with no hardware reference clocks in sight, chrony will
+probably work much better for you.
+
+For a more detailed comparison of features and performance, see the comparison
+page on the chrony website.
2. Configuration issues
- 2.1. What is the minimum recommended configuration for an NTP client?
-
- First, the client needs to know which NTP servers it should ask for the
- current time. They are specified by the server or pool directive. The
- pool directive can be used for names that resolve to multiple
- addresses. For good reliability the client should have at least three
- servers. The iburst option speeds up the initial synchronisation.
-
- To stabilize the initial synchronisation on the next start, the
- estimated drift of the system clock is saved by adding the driftfile
- directive.
-
- If the system clock can be far from the true time after boot for any
- reason, chronyd should be allowed to correct it quickly by stepping
- instead of slewing, which would take a very long time. The makestep
- directive does that.
-
- In order to keep the real-time clock (RTC) close to the true time on
- Linux, so the system time is reasonably close to the true time when
- it’s initialized on the next boot from the RTC, the rtcsync directive
- enables a kernel mode in which the system time is copied to the RTC
- every 11 minutes.
-
- If you want to use public NTP servers from the [3]pool.ntp.org project,
- the minimal chrony.conf file could be:
-
- pool pool.ntp.org iburst
- driftfile /var/lib/chrony/drift
- makestep 1 3
- rtcsync
-
- 2.2. How do I make an NTP server from an NTP client?
-
- You need to add an allow directive to the chrony.conf file in order to
- open the NTP port and allow chronyd to reply to client requests. allow
- with no specified subnet allows all IPv4 and IPv6 addresses.
-
- 2.3. I have several computers on a LAN. Should be all clients of an external
- server?
-
- The best configuration is usually to make one computer the master, with
- the others as clients of it. Add a local directive to the master’s
- chrony.conf file. This configuration will be better because
- * the load on the external connection is less
- * the load on the external NTP server(s) is less
- * if your external connection goes down, the computers on the LAN
- will maintain a common time with each other.
-
- 2.4. Must I specify servers by IP address if DNS is not available on chronyd
- start?
-
- No. Starting from version 1.25, chronyd will keep trying to resolve the
- hostnames specified in the server and peer directives in increasing
- intervals until it succeeds. The online command can be issued from
- chronyc to try to resolve them immediately.
-
- 2.5. How can I make chronyd more secure?
-
- If you don’t need to serve time to NTP clients or peers, you can add
- port 0 to the chrony.conf file to completely disable the NTP server
- functionality and prevent NTP requests from reaching chronyd. Starting
- from version 2.0, the NTP server port is open only when client access
- is allowed by the allow directive or command, an NTP peer is
- configured, or the broadcast directive is used.
-
- If you don’t need to use chronyc remotely, you can add the following
- directives to the configuration file to bind the command sockets to the
- loopback interface. This is done by default since version 2.0.
-
- bindcmdaddress 127.0.0.1
- bindcmdaddress ::1
-
- If you don’t need to use chronyc at all or you need to run chronyc only
- under the root or chrony user (which can access chronyd through a Unix
- domain socket since version 2.2), you can disable the internet command
- sockets completely by adding cmdport 0 to the configuration file.
-
- You can specify an unprivileged user with the -u option, or the user
- directive in the chrony.conf file, to which chronyd will switch after
- start in order to drop root privileges. The configure script has a
- --with-user option, which sets the default user. On Linux, chronyd
- needs to be compiled with support for the libcap library. On other
- systems, chronyd forks into two processes. The child process retains
- root privileges, but can only perform a very limited range of
- privileged system calls on behalf of the parent.
-
- Also, if chronyd is compiled with support for the Linux secure
- computing (seccomp) facility, you can enable a system call filter with
- the -F option. It will significantly reduce the kernel attack surface
- and possibly prevent kernel exploits from the chronyd process if it’s
- compromised. It’s recommended to enable the filter only when it’s known
- to work on the version of the system where chrony is installed as the
- filter needs to allow also system calls made from libraries that
- chronyd is using (e.g. libc) and different versions or implementations
- of the libraries may make different system calls. If the filter is
- missing some system call, chronyd could be killed even in normal
- operation.
-
- 2.6. How can I improve the accuracy of the system clock with NTP sources?
-
- Select NTP servers that are well synchronised, stable and close to your
- network. It’s better to use more than one server, three or four is
- usually recommended as the minimum, so chronyd can detect falsetickers
- and combine measurements from multiple sources.
-
- There are also useful options which can be set in the server directive,
- they are minpoll, maxpoll, polltarget, maxdelay, maxdelayratio and
- maxdelaydevratio.
-
- The first three options set the minimum and maximum allowed polling
- interval, and how should be the actual interval adjusted in the
- specified range. Their default values are 6 (64 seconds) for minpoll,
- 10 (1024 seconds) for maxpoll and 6 (samples) for polltarget. The
- default values should be used for general servers on the internet. With
- your own NTP servers or if have permission to poll some servers more
- frequently, setting these options for shorter polling intervals may
- significantly improve the accuracy of the system clock.
-
- The optimal polling interval depends on many factors, including the
- ratio between the wander of the clock and the network jitter (sometimes
- expressed in NTP documents as the Allan intercept), the temperature
- sensitivity of the crystal oscillator and the maximum rate of change of
- the temperature.
-
- An example of the directive for an NTP server on the internet that you
- are allowed to poll frequently could be
-
- server foo.example.net minpoll 4 maxpoll 6 polltarget 16
-
- An example using very short polling intervals for a server located in
- the same LAN could be
-
- server ntp.local minpoll 2 maxpoll 4 polltarget 30
-
- The maxdelay options are useful to ignore measurements with larger
- delay (e.g. due to congestion in the network) and improve the stability
- of the synchronisation. The maxdelaydevratio option could be added to
- the example with local NTP server
-
- server ntp.local minpoll 2 maxpoll 4 polltarget 30 maxdelaydevratio 2
-
- 2.7. What happened to the commandkey and generatecommandkey directives?
-
- They were removed in version 2.2. Authentication is no longer supported
- in the command protocol. Commands that required authentication are now
- allowed only through a Unix domain socket, which is accessible only by
- the root and chrony users. If you need to configure chronyd remotely or
- locally without the root password, please consider using ssh and/or
- sudo to run chronyc under the root or chrony user on the same host as
- chronyd is running.
- __________________________________________________________________
+2.1. What is the minimum recommended configuration for an NTP client?
+
+First, the client needs to know which NTP servers it should ask for the current
+time. They are specified by the server or pool directive. The pool directive
+can be used for names that resolve to multiple addresses. For good reliability
+the client should have at least three servers. The iburst option speeds up the
+initial synchronisation.
+
+To stabilize the initial synchronisation on the next start, the estimated drift
+of the system clock is saved to a file specified by the driftfile directive.
+
+If the system clock can be far from the true time after boot for any reason,
+chronyd should be allowed to correct it quickly by stepping instead of slewing,
+which would take a very long time. The makestep directive does that.
+
+In order to keep the real-time clock (RTC) close to the true time, so the
+system time is reasonably close to the true time when it's initialized on the
+next boot from the RTC, the rtcsync directive enables a mode in which the
+system time is periodically copied to the RTC. It is supported on Linux and Mac
+OS X.
+
+If you want to use public NTP servers from the pool.ntp.org project, the
+minimal chrony.conf file could be:
+
+pool pool.ntp.org iburst
+driftfile /var/lib/chrony/drift
+makestep 1 3
+rtcsync
+
+2.2. How do I make an NTP server from an NTP client?
+
+You need to add an allow directive to the chrony.conf file in order to open the
+NTP port and allow chronyd to reply to client requests. allow with no specified
+subnet allows all IPv4 and IPv6 addresses.
+
+2.3. I have several computers on a LAN. Should be all clients of an external
+server?
+
+The best configuration is usually to make one computer the server, with the
+others as clients of it. Add a local directive to the server's chrony.conf
+file. This configuration will be better because
+
+ o the load on the external connection is less
+
+ o the load on the external NTP server(s) is less
+
+ o if your external connection goes down, the computers on the LAN will
+ maintain a common time with each other.
+
+2.4. Must I specify servers by IP address if DNS is not available on chronyd
+start?
+
+No. Starting from version 1.25, chronyd will keep trying to resolve the names
+specified by the server, pool, and peer directives in an increasing interval
+until it succeeds. The online command can be issued from chronyc to try to
+resolve them immediately.
+
+2.5. How can I make chronyd more secure?
+
+If you don't need to serve time to NTP clients or peers, you can add port 0 to
+the chrony.conf file to completely disable the NTP server functionality and
+prevent NTP requests from reaching chronyd. Starting from version 2.0, the NTP
+server port is open only when client access is allowed by the allow directive
+or command, an NTP peer is configured, or the broadcast directive is used.
+
+If you don't need to use chronyc remotely, you can add the following directives
+to the configuration file to bind the command sockets to the loopback
+interface. This is done by default since version 2.0.
+
+bindcmdaddress 127.0.0.1
+bindcmdaddress ::1
+
+If you don't need to use chronyc at all or you need to run chronyc only under
+the root or chrony user (which can access chronyd through a Unix domain socket
+since version 2.2), you can disable the internet command sockets completely by
+adding cmdport 0 to the configuration file.
+
+You can specify an unprivileged user with the -u option, or the user directive
+in the chrony.conf file, to which chronyd will switch after start in order to
+drop root privileges. The configure script has a --with-user option, which sets
+the default user. On Linux, chronyd needs to be compiled with support for the
+libcap library. On other systems, chronyd forks into two processes. The child
+process retains root privileges, but can only perform a very limited range of
+privileged system calls on behalf of the parent.
+
+Also, if chronyd is compiled with support for the Linux secure computing
+(seccomp) facility, you can enable a system call filter with the -F option. It
+will significantly reduce the kernel attack surface and possibly prevent kernel
+exploits from the chronyd process if it's compromised. It's recommended to
+enable the filter only when it's known to work on the version of the system
+where chrony is installed as the filter needs to allow also system calls made
+from libraries that chronyd is using (e.g. libc) and different versions or
+implementations of the libraries may make different system calls. If the filter
+is missing some system call, chronyd could be killed even in normal operation.
+
+2.6. How can I improve the accuracy of the system clock with NTP sources?
+
+Select NTP servers that are well synchronised, stable and close to your
+network. It's better to use more than one server, three or four is usually
+recommended as the minimum, so chronyd can detect servers that serve false time
+and combine measurements from multiple sources.
+
+There are also useful options which can be set in the server directive, they
+are minpoll, maxpoll, polltarget, maxdelay, maxdelayratio and maxdelaydevratio.
+
+The first three options set the minimum and maximum allowed polling interval,
+and how should be the actual interval adjusted in the specified range. Their
+default values are 6 (64 seconds) for minpoll, 10 (1024 seconds) for maxpoll
+and 6 (samples) for polltarget. The default values should be used for general
+servers on the Internet. With your own NTP servers or if have permission to
+poll some servers more frequently, setting these options for shorter polling
+intervals may significantly improve the accuracy of the system clock.
+
+The optimal polling interval depends mainly on two factors, stability of the
+network latency and stability of the system clock (which mainly depends on the
+temperature sensitivity of the crystal oscillator and the maximum rate of the
+temperature change).
+
+An example of the directive for an NTP server on the Internet that you are
+allowed to poll frequently could be
+
+server foo.example.net minpoll 4 maxpoll 6 polltarget 16
+
+An example using very short polling intervals for a server located in the same
+LAN could be
+
+server ntp.local minpoll 2 maxpoll 4 polltarget 30
+
+The maxdelay options are useful to ignore measurements with larger delay (e.g.
+due to congestion in the network) and improve the stability of the
+synchronisation. The maxdelaydevratio option could be added to the example with
+local NTP server
+
+server ntp.local minpoll 2 maxpoll 4 polltarget 30 maxdelaydevratio 2
+
+2.7. What happened to the commandkey and generatecommandkey directives?
+
+They were removed in version 2.2. Authentication is no longer supported in the
+command protocol. Commands that required authentication are now allowed only
+through a Unix domain socket, which is accessible only by the root and chrony
+users. If you need to configure chronyd remotely or locally without the root
+password, please consider using ssh and/or sudo to run chronyc under the root
+or chrony user on the host where chronyd is running.
3. Computer is not synchronising
- This is the most common problem. There are a number of reasons, see the
- following questions.
+This is the most common problem. There are a number of reasons, see the
+following questions.
- 3.1. Behind a firewall?
+3.1. Behind a firewall?
- If there is a firewall between you and the NTP server you’re trying to
- use, the packets may be blocked. Try using a tool like wireshark or
- tcpdump to see if you’re getting responses from the server. If you have
- an external modem, see if the receive light blinks straight after the
- transmit light (when the link is quiet apart from the NTP traffic.) Try
- adding log measurements to the chrony.conf file and look in the
- measurements.log file after chronyd has been running for a short
- period. See if any measurements appear.
+Check the Reach value printed by the chronyc's sources command. If it's zero,
+it means chronyd did not get any valid responses from the NTP server you are
+trying to use. If there is a firewall between you and the server, the packets
+may be blocked. Try using a tool like wireshark or tcpdump to see if you're
+getting any responses from the server.
- 3.2. Are NTP servers specified with the offline option?
+When chronyd is receiving responses from the servers, the output of the sources
+command issued few minutes after chronyd start might look like this:
- Check that you’re using chronyc's online and offline commands
- appropriately. Again, check in measurements.log to see if you’re
- getting any data back from the server.
+210 Number of sources = 3
+MS Name/IP address Stratum Poll Reach LastRx Last sample
+===============================================================================
+^* foo.example.net 2 6 377 34 +484us[ -157us] +/- 30ms
+^- bar.example.net 2 6 377 34 +33ms[ +32ms] +/- 47ms
+^+ baz.example.net 3 6 377 35 -1397us[-2033us] +/- 60ms
- 3.3. Is chronyd allowed to step the system clock?
+3.2. Are NTP servers specified with the offline option?
- By default, chronyd adjusts the clock gradually by slowing it down or
- speeding it up. If the clock is too far from the correct time, it will
- take a long time to correct the error. The System time value printed by
- the chronyc's tracking command is the remaining correction that needs
- to be applied to the system clock.
+Check that you're using chronyc's online and offline commands appropriately.
+Again, check in measurements.log to see if you're getting any data back from
+the server.
- The makestep directive can be used to allow chronyd to step the clock.
- For example, if chrony.conf had
+3.3. Is chronyd allowed to step the system clock?
- makestep 1 3
+By default, chronyd adjusts the clock gradually by slowing it down or speeding
+it up. If the clock is too far from the true time, it will take a long time to
+correct the error. The System time value printed by the chronyc's tracking
+command is the remaining correction that needs to be applied to the system
+clock.
- the clock would be stepped in the first three updates if its offset was
- larger than one second. Normally, it’s recommended to allow the step
- only in the first few updates, but in some cases (e.g. a computer
- without RTC or virtual machine which can be suspended and resumed with
- incorrect time) it may be necessary to allow the step at any clock
- update. The example above would change to
+The makestep directive can be used to allow chronyd to step the clock. For
+example, if chrony.conf had
- makestep 1 -1
- __________________________________________________________________
+makestep 1 3
+
+the clock would be stepped in the first three updates if its offset was larger
+than one second. Normally, it's recommended to allow the step only in the first
+few updates, but in some cases (e.g. a computer without an RTC or virtual
+machine which can be suspended and resumed with an incorrect time) it may be
+necessary to allow the step on any clock update. The example above would change
+to
+
+makestep 1 -1
4. Issues with chronyc
- 4.1. I keep getting the error 506 Cannot talk to daemon
+4.1. I keep getting the error 506 Cannot talk to daemon
+
+When accessing chronyd remotely, make sure that the chrony.conf file (on the
+computer where chronyd is running) has a cmdallow entry for the computer you
+are running chronyc on and an appropriate bindcmdaddress directive. This isn't
+necessary for localhost.
- When accessing chronyd remotely, make sure that the chrony.conf file
- (on the computer where chronyd is running) has a cmdallow entry for the
- computer you are running chronyc on and an appropriate bindcmdaddress
- directive. This isn’t necessary for localhost.
+Perhaps chronyd is not running. Try using the ps command (e.g. on Linux, ps
+-auxw) to see if it's running. Or try netstat -a and see if the ports 123/udp
+and 323/udp are listening. If chronyd is not running, you may have a problem
+with the way you are trying to start it (e.g. at boot time).
- Perhaps chronyd is not running. Try using the ps command (e.g. on
- Linux, ps -auxw) to see if it’s running. Or try netstat -a and see if
- the ports 123/udp and 323/udp are listening. If chronyd is not running,
- you may have a problem with the way you are trying to start it (e.g. at
- boot time).
+Perhaps you have a firewall set up in a way that blocks packets on port 323/
+udp. You need to amend the firewall configuration in this case.
- Perhaps you have a firewall set up in a way that blocks packets on port
- 323/udp. You need to amend the firewall configuration in this case.
+4.2. I keep getting the error 501 Not authorised
- 4.2. I keep getting the error 501 Not authorised
+Since version 2.2, the password command doesn't do anything and chronyc needs
+to run locally under the root or chrony user, which are allowed to access the
+chronyd's Unix domain command socket.
- Since version 2.2, the password command doesn’t do anything and chronyc
- needs to run under the root or chrony user, which are allowed to access
- the Unix domain command socket.
+With older versions, you need to authenticate with the password command first
+or use the -a option to authenticate automatically on start. The configuration
+file needs to specify a file which contains keys (keyfile directive) and which
+key in the key file should be used for chronyc authentication (commandkey
+directive).
- 4.3. Is the chronyc / chronyd protocol documented anywhere?
+4.3. Why does chronyc tracking always print an IPv4 address as reference ID?
- Only by the source code :-) See cmdmon.c (chronyd side) and client.c
- (chronyc side).
- __________________________________________________________________
+The reference ID is a 32-bit value and is always printed in quad-dotted
+notation, even if the reference source doesn't have an IPv4 address. For IPv4
+addresses, the reference ID is equal to the address, but for IPv6 addresses it
+is the first 32 bits of the MD5 sum of the address. For reference clocks, the
+reference ID is the value specified with the refid option in the refclock
+directive.
+
+If you need to get the IP address of the current reference source, use the -n
+option to disable resolving of IP addresses and read the second field (printed
+in parentheses) on the Reference ID line.
+
+4.4. Is the chronyc / chronyd protocol documented anywhere?
+
+Only by the source code. See cmdmon.c (chronyd side) and client.c (chronyc
+side).
5. Real-time clock issues
- 5.1. What is the real-time clock (RTC)?
-
- This is the clock which keeps the time even when your computer is
- turned off. It is used to initialize the system clock on boot. It
- normally doesn’t drift more than few seconds per day.
-
- There are two approaches how chronyd can work with it. One is to use
- the rtcsync directive, which tells chronyd to enable a kernel mode
- which sets the RTC from the system clock every 11 minutes. chronyd
- itself won’t touch the RTC. If the computer is not turned off for a
- long time, the RTC should still be close to the true time when the
- system clock will be initialized from it on the next boot.
-
- The other option is to use the rtcfile directive, which will tell
- chronyd to monitor the rate at which the RTC gains or loses time. When
- chronyd is started with the -s option on the next boot, it will set the
- system time from the RTC and also compensate for the drift it has
- measured previously. The rtcautotrim directive can be used to keep the
- RTC close to the true time, but it’s not strictly necessary if its only
- purpose is to set the system clock when chronyd is started on boot. See
- the documentation for details.
-
- 5.2. I want to use chronyd's RTC support. Must I disable hwclock?
-
- The hwclock program is often set-up by default in the boot and shutdown
- scripts with many Linux installations. With the kernel RTC
- synchronisation (rtcsync directive), the RTC will be set also every 11
- minutes as long as the system clock is synchronised. If you want to use
- chronyd's RTC monitoring (rtcfile directive), it’s important to disable
- hwclock in the shutdown procedure. If you don’t, it will over-write the
- RTC with a new value, unknown to chronyd. At the next reboot, chronyd
- started with the -s option will compensate this (wrong) time with its
- estimate of how far the RTC has drifted whilst the power was off,
- giving a meaningless initial system time.
-
- There is no need to remove hwclock from the boot process, as long as
- chronyd is started after it has run.
-
- 5.3. I just keep getting the 513 RTC driver not running message
-
- For the real time clock support to work, you need the following three
- things
- * a kernel that is supported (e.g. 2.2 onwards)
- * enhanced RTC support compiled into the kernel
- * an rtcfile directive in your chrony.conf file
- __________________________________________________________________
+5.1. What is the real-time clock (RTC)?
-6. NTP-specific issues
+This is the clock which keeps the time even when your computer is turned off.
+It is used to initialize the system clock on boot. It normally doesn't drift
+more than few seconds per day.
+
+There are two approaches how chronyd can work with it. One is to use the
+rtcsync directive, which tells chronyd to enable a kernel mode which sets the
+RTC from the system clock every 11 minutes. chronyd itself won't touch the RTC.
+If the computer is not turned off for a long time, the RTC should still be
+close to the true time when the system clock will be initialized from it on the
+next boot.
+
+The other option is to use the rtcfile directive, which tells chronyd to
+monitor the rate at which the RTC gains or loses time. When chronyd is started
+with the -s option on the next boot, it will set the system time from the RTC
+and also compensate for the drift it has measured previously. The rtcautotrim
+directive can be used to keep the RTC close to the true time, but it's not
+strictly necessary if its only purpose is to set the system clock when chronyd
+is started on boot. See the documentation for details.
+
+5.2. I want to use chronyd's RTC support. Must I disable hwclock?
- 6.1. Can chronyd be driven from broadcast NTP servers?
+The hwclock program is often set-up by default in the boot and shutdown scripts
+with many Linux installations. With the kernel RTC synchronisation (rtcsync
+directive), the RTC will be set also every 11 minutes as long as the system
+clock is synchronised. If you want to use chronyd's RTC monitoring (rtcfile
+directive), it's important to disable hwclock in the shutdown procedure. If you
+don't, it will over-write the RTC with a new value, unknown to chronyd. At the
+next reboot, chronyd started with the -s option will compensate this (wrong)
+time with its estimate of how far the RTC has drifted whilst the power was off,
+giving a meaningless initial system time.
- No, the broadcast client mode is not supported and there is currently
- no plan to implement it. The broadcast and multicast modes are
- inherently less accurate and less secure (even with authentication)
- than the ordinary server/client mode and they are not as useful as they
- used to be. Even with very modest hardware a single NTP server can
- serve time to hundreds of thousands of clients using the ordinary mode.
+There is no need to remove hwclock from the boot process, as long as chronyd is
+started after it has run.
- 6.2. Can chronyd transmit broadcast NTP packets?
+5.3. I just keep getting the 513 RTC driver not running message
- Yes, the broadcast directive can be used to enable the broadcast server
- mode to serve time to clients in the network which support the
- broadcast client mode (it’s not supported in chronyd, see the previous
- question).
+For the real-time clock support to work, you need the following three things
- 6.3. Can chronyd keep the system clock a fixed offset away from real time?
+ o an RTC in your computer
+
+ o a Linux kernel with enabled RTC support
+
+ o an rtcfile directive in your chrony.conf file
+
+5.4. I get Could not open /dev/rtc, Device or resource busy in my syslog file
+
+Some other program running on the system may be using the device.
+
+6. NTP-specific issues
- This is not possible as the program currently stands.
+6.1. Can chronyd be driven from broadcast NTP servers?
- 6.4. What happens if the network connection is dropped without using chronyc's
- offline command first?
+No, the broadcast client mode is not supported and there is currently no plan
+to implement it. The broadcast and multicast modes are inherently less accurate
+and less secure (even with authentication) than the ordinary server/client mode
+and they are not as useful as they used to be. Even with very modest hardware a
+single NTP server can serve time to hundreds of thousands of clients using the
+ordinary mode.
- chronyd will keep trying to access the server(s) that it thinks are
- online. When the network is connected again, it will take some time (on
- average half of the current polling interval) before new measurements
- are made and the clock is corrected. If the servers were set to offline
- and the online command was issued when the network was connected,
- chronyd would make new measurements immediately.
+6.2. Can chronyd transmit broadcast NTP packets?
- The auto_offline option to the server entry in the chrony.conf file may
- be useful to switch the servers to the offline state automatically.
- __________________________________________________________________
+Yes, the broadcast directive can be used to enable the broadcast server mode to
+serve time to clients in the network which support the broadcast client mode
+(it's not supported in chronyd, see the previous question).
-7. Linux-specific issues
+6.3. Can chronyd keep the system clock a fixed offset away from real time?
- 7.1. I get Could not open /dev/rtc, Device or resource busy in my syslog file
+This is not possible as the program currently stands.
- Some other program running on the system may be using the device.
- __________________________________________________________________
+6.4. What happens if the network connection is dropped without using chronyc's
+offline command first?
-8. Microsoft Windows
+chronyd will keep trying to access the server(s) that it thinks are online.
+When the network is connected again, it will take some time (on average half of
+the maximum polling interval) before new measurements are made and the clock is
+corrected. If the servers were set to offline and the online command was issued
+when the network was connected, chronyd would make new measurements
+immediately.
- 8.1. Does chrony support Windows?
+The auto_offline option to the server entry in the chrony.conf file may be
+useful to switch the servers to the offline state automatically.
- No. The chronyc program (the command-line client used for configuring
- chronyd while it is running) has been successfully built and run under
- Cygwin in the past. chronyd is not portable, because part of it is very
- system-dependent. It needs adapting to work with Windows' equivalent of
- the adjtimex() call, and it needs to be made to work as a service.
+7. Operating systems
- 8.2. Are there any plans to support Windows?
+7.1. Does chrony support Windows?
- We have no plans to do this. Anyone is welcome to pick this work up and
- contribute it back to the project.
- __________________________________________________________________
+No. The chronyc program (the command-line client used for configuring chronyd
+while it is running) has been successfully built and run under Cygwin in the
+past. chronyd is not portable, because part of it is very system-dependent. It
+needs adapting to work with Windows' equivalent of the adjtimex() call, and it
+needs to be made to work as a service.
- Last updated 2016-02-16 14:25:38 CET
+7.2. Are there any plans to support Windows?
-References
+We have no plans to do this. Anyone is welcome to pick this work up and
+contribute it back to the project.
- 1. http://chrony.tuxfamily.org/comparison.html
- 2. http://chrony.tuxfamily.org/manual.html#Comparison-with-ntpd
- 3. http://www.pool.ntp.org/
+Last updated 2016-06-07 11:20:59 CEST
diff --git a/INSTALL b/INSTALL
index 5f608aa..e6df96d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,104 +1,150 @@
-The software is distributed as source code which has to be compiled.
-The source code is supplied in the form of a gzipped tar file, which
-unpacks to a subdirectory identifying the name and version of the
-program.
+Installation
+
+The software is distributed as source code which has to be compiled. The source
+code is supplied in the form of a gzipped tar file, which unpacks to a
+subdirectory identifying the name and version of the program.
After unpacking the source code, change directory into it, and type
- ./configure
+./configure
-This is a shell script that automatically determines the system type.
-There is a single optional parameter, '--prefix' which indicates the
-directory tree where the software should be installed. For example,
+This is a shell script that automatically determines the system type. There is
+a single optional parameter, --prefix which indicates the directory tree where
+the software should be installed. For example,
- ./configure --prefix=/opt/free
+./configure --prefix=/opt/free
-will install the 'chronyd' daemon into /opt/free/sbin and the 'chronyc'
-control program into /opt/free/bin. The default value for the prefix is
-/usr/local.
+will install the chronyd daemon into /opt/free/sbin and the chronyc control
+program into /opt/free/bin. The default value for the prefix is /usr/local.
-The configure script assumes you want to use gcc as your compiler. If
-you want to use a different compiler, you can configure this way:
+The configure script assumes you want to use gcc as your compiler. If you want
+to use a different compiler, you can configure this way:
- CC=cc CFLAGS=-O ./configure --prefix=/opt/free
+CC=cc CFLAGS=-O ./configure --prefix=/opt/free
for Bourne-family shells, or
- setenv CC cc
- setenv CFLAGS -O
- ./configure --prefix=/opt/free
+setenv CC cc
+setenv CFLAGS -O
+./configure --prefix=/opt/free
for C-family shells.
-If the software cannot (yet) be built on your system, an error message
-will be shown. Otherwise, 'Makefile' will be generated.
+If the software cannot (yet) be built on your system, an error message will be
+shown. Otherwise, Makefile will be generated.
-On Linux, if development files for the libcap library are available,
-'chronyd' will be built with support for dropping root privileges. On
-other systems no extra library is needed. The default user which
-'chronyd' should run as can be specified with the '--with-user' option
-of the configure script.
+On Linux, if development files for the libcap library are available, chronyd
+will be built with support for dropping root privileges. On other systems no
+extra library is needed. The default user which chronyd should run as can be
+specified with the --with-user option of the configure script.
If development files for the editline or readline library are available,
-'chronyc' will be built with line editing support. If you don't want
-this, specify the -disable-readline flag to configure. Please refer to
-*note line editing support:: for more information.
+chronyc will be built with line editing support. If you don't want this,
+specify the --disable-readline flag to configure.
-If a 'timepps.h' header is available (e.g. from the LinuxPPS project
-(http://linuxpps.org/)), 'chronyd' will be built with PPS API reference
-clock driver. If the header is installed in a location that isn't
-normally searched by the compiler, you can add it to the searched
-locations by setting 'CPPFLAGS' variable to '-I/path/to/timepps'.
+If a timepps.h header is available (e.g. from the LinuxPPS project), chronyd
+will be built with PPS API reference clock driver. If the header is installed
+in a location that isn't normally searched by the compiler, you can add it to
+the searched locations by setting the CPPFLAGS variable to -I/path/to/timepps.
Now type
- make
+make
to build the programs.
-If you want to build the manual in plain text, HTML and info versions,
-type
+If you want to build the manual in HTML, type
+
+make docs
+
+Once the programs have been successfully compiled, they need to be installed in
+their target locations. This step normally needs to be performed by the
+superuser, and requires the following command to be entered.
+
+make install
+
+This will install the binaries and man pages.
+
+To install the HTML version of the manual, enter the command
+
+make install-docs
+
+Now that the software is successfully installed, the next step is to set up a
+configuration file. The default location of the file is /etc/chrony.conf.
+Several examples of configuration with comments are included in the examples
+directory. Suppose you want to use public NTP servers from the pool.ntp.org
+project as your time reference. A minimal useful configuration file could be
+
+pool pool.ntp.org iburst
+makestep 1.0 3
+rtcsync
+
+Then, chronyd can be run. For security reasons, it's recommended to create an
+unprivileged user for chronyd and specify it with the -u command-line option or
+the user directive in the configuration file, or set the default user with the
+--with-user configure option before building.
+
+Support for line editing libraries
+
+chronyc can be built with support for line editing, this allows you to use the
+cursor keys to replay and edit old commands. Two libraries are supported which
+provide such functionality, editline and GNU readline.
+
+Please note that readline since version 6.0 is licensed under GPLv3+ which is
+incompatible with chrony's license GPLv2. You should use editline instead if
+you don't want to use older readline versions.
+
+The configure script will automatically enable the line editing support if one
+of the supported libraries is available. If they are both available, the
+editline library will be used.
+
+If you don't want to use it (in which case chronyc will use a minimal command
+line interface), invoke configure like this:
+
+./configure --disable-readline other-options...
+
+If you have editline, readline or ncurses installed in locations that aren't
+normally searched by the compiler and linker, you need to use extra options:
+
+--with-readline-includes=directory_name
+
+ This defines the name of the directory above the one where readline.h is.
+ readline.h is assumed to be in editline or readline subdirectory of the
+ named directory.
+
+--with-readline-library=directory_name
+
+ This defines the directory containing the libedit.a or libedit.so file, or
+ libreadline.a or libreadline.so file.
- make docs
+--with-ncurses-library=directory_name
-Once the programs have been successfully compiled, they need to be
-installed in their target locations. This step normally needs to be
-performed by the superuser, and requires the following command to be
-entered.
+ This defines the directory containing the libncurses.a or libncurses.so
+ file.
- make install
+Extra options for package builders
-This will install the binaries and manpages.
+The configure and make procedures have some extra options that may be useful if
+you are building a distribution package for chrony.
-To install the plain text, HTML and info versions of the manual, enter
-the command
+The --mandir=DIR option to configure specifies an install directory for the man
+pages. This overrides the man subdirectory of the argument to the --prefix
+option.
- make install-docs
+./configure --prefix=/usr --mandir=/usr/share/man
-If you want chrony to appear in the top level info directory listing,
-you need to run the 'install-info' command manually after this step.
-'install-info' takes 2 arguments. The first is the path to the
-'chrony.info' file you have just installed. This will be the argument
-you gave to -prefix when you configured ('/usr/local' by default), with
-'/share/info/chrony.info' on the end. The second argument is the
-location of the file called 'dir'. This will typically be
-'/usr/share/info/dir'. So the typical command line would be
+to set both options together.
- install-info /usr/local/share/info/chrony.info /usr/share/info/dir
+The final option is the DESTDIR option to the make command. For example, you
+could use the commands
-Now that the software is successfully installed, the next step is to set
-up a configuration file. The default location of the file is
-'/etc/chrony.conf'. Several examples of configuration with comments are
-included in the examples directory. Suppose you want to use public NTP
-servers from the pool.ntp.org project as your time reference. A minimal
-useful configuration file could be
+./configure --prefix=/usr --mandir=/usr/share/man
+make all docs
+make install DESTDIR=./tmp
+cd tmp
+tar cvf - . | gzip -9 > chrony.tar.gz
- pool pool.ntp.org iburst
- makestep 1.0 3
- rtcsync
+to build a package. When untarred within the root directory, this will install
+the files to the intended final locations.
-Then, 'chronyd' can be run. For security reasons, it's recommended to
-create an unprivileged user for 'chronyd' and specify it with the '-u'
-command-line option or the 'user' directive in the configuration file,
-or set the default user with the '--with-user' configure option before
-building.
+Last updated 2016-06-07 11:20:59 CEST
diff --git a/Makefile.in b/Makefile.in
index c87f67f..ea47830 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -24,9 +24,6 @@
SYSCONFDIR=@SYSCONFDIR@
BINDIR=@BINDIR@
SBINDIR=@SBINDIR@
-MANDIR=@MANDIR@
-INFODIR=@INFODIR@
-DOCDIR=@DOCDIR@
LOCALSTATEDIR=@LOCALSTATEDIR@
CHRONYVARDIR=@CHRONYVARDIR@
@@ -74,11 +71,12 @@ $(HASH_OBJ) : $(patsubst %.o,%.c,$(HASH_OBJ))
distclean : clean
-rm -f .DS_Store
- -rm -f Makefile
- -rm -f chrony.conf.5 chrony.texi chronyc.1 chronyd.8
+ -rm -f Makefile config.h config.log
+ $(MAKE) -C doc distclean
+ $(MAKE) -C test/unit distclean
clean :
- -rm -f *.o *.s chronyc chronyd core *~ chrony.info chrony.html chrony.txt
+ -rm -f *.o *.s chronyc chronyd core *~
-rm -rf .deps
-rm -rf *.dSYM
@@ -96,9 +94,6 @@ install: chronyd chronyc
[ -d $(DESTDIR)$(SYSCONFDIR) ] || mkdir -p $(DESTDIR)$(SYSCONFDIR)
[ -d $(DESTDIR)$(SBINDIR) ] || mkdir -p $(DESTDIR)$(SBINDIR)
[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
- [ -d $(DESTDIR)$(MANDIR)/man1 ] || mkdir -p $(DESTDIR)$(MANDIR)/man1
- [ -d $(DESTDIR)$(MANDIR)/man5 ] || mkdir -p $(DESTDIR)$(MANDIR)/man5
- [ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
[ -d $(DESTDIR)$(CHRONYVARDIR) ] || mkdir -p $(DESTDIR)$(CHRONYVARDIR)
if [ -f $(DESTDIR)$(SBINDIR)/chronyd ]; then rm -f $(DESTDIR)$(SBINDIR)/chronyd ; fi
if [ -f $(DESTDIR)$(BINDIR)/chronyc ]; then rm -f $(DESTDIR)$(BINDIR)/chronyc ; fi
@@ -106,12 +101,13 @@ install: chronyd chronyc
chmod 755 $(DESTDIR)$(SBINDIR)/chronyd
cp chronyc $(DESTDIR)$(BINDIR)/chronyc
chmod 755 $(DESTDIR)$(BINDIR)/chronyc
- cp chronyc.1 $(DESTDIR)$(MANDIR)/man1
- chmod 644 $(DESTDIR)$(MANDIR)/man1/chronyc.1
- cp chronyd.8 $(DESTDIR)$(MANDIR)/man8
- chmod 644 $(DESTDIR)$(MANDIR)/man8/chronyd.8
- cp chrony.conf.5 $(DESTDIR)$(MANDIR)/man5
- chmod 644 $(DESTDIR)$(MANDIR)/man5/chrony.conf.5
+ $(MAKE) -C doc install
+
+docs :
+ $(MAKE) -C doc docs
+
+install-docs :
+ $(MAKE) -C doc install-docs
%.o : %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
@@ -123,28 +119,6 @@ check : chronyd chronyc
$(MAKE) -C test/unit check
cd test/simulation && ./run
-install-docs : docs
- [ -d $(DESTDIR)$(DOCDIR) ] || mkdir -p $(DESTDIR)$(DOCDIR)
- cp chrony.txt $(DESTDIR)$(DOCDIR)/chrony.txt
- chmod 644 $(DESTDIR)$(DOCDIR)/chrony.txt
- cp chrony.html $(DESTDIR)$(DOCDIR)/chrony.html
- chmod 644 $(DESTDIR)$(DOCDIR)/chrony.html
- [ -d $(DESTDIR)$(INFODIR) ] || mkdir -p $(DESTDIR)$(INFODIR)
- cp chrony.info* $(DESTDIR)$(INFODIR)
- chmod 644 $(DESTDIR)$(INFODIR)/chrony.info*
-
-docs : chrony.txt chrony.html chrony.info
-
-chrony.txt : chrony.texi
- makeinfo --no-headers --number-sections -o chrony.txt chrony.texi
-
-chrony.html : chrony.texi
- command -v texi2html > /dev/null 2>&1 && texi2html chrony.texi || \
- makeinfo --no-split --html --number-sections -o chrony.html chrony.texi
-
-chrony.info : chrony.texi
- makeinfo chrony.texi
-
Makefile : Makefile.in configure
@echo
@echo Makefile needs to be regenerated, run ./configure
diff --git a/NEWS b/NEWS
index 1f4c298..a293541 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,32 @@
+New in version 2.4
+==================
+
+Enhancements
+------------
+* Add orphan option to local directive for orphan mode compatible with ntpd
+* Add distance option to local directive to set activation threshold
+ (1 second by default)
+* Add maxdrift directive to set maximum allowed drift of system clock
+* Try to replace NTP sources exceeding maximum distance
+* Randomise source replacement to avoid getting stuck with bad sources
+* Randomise selection of sources from pools on start
+* Ignore reference timestamp as ntpd doesn't always set it correctly
+* Modify tracking report to use same values as seen by NTP clients
+* Add -c option to chronyc to write reports in CSV format
+* Provide detailed manual pages
+
+Bug fixes
+---------
+* Fix SOCK refclock to work correctly when not specified as last refclock
+* Fix initstepslew and -q/-Q options to accept time from own NTP clients
+* Fix authentication with keys using 512-bit hash functions
+* Fix crash on exit when multiple signals are received
+* Fix conversion of very small floating-point numbers in command packets
+
+Removed features
+----------------
+* Drop documentation in Texinfo format
+
New in version 2.3
==================
diff --git a/README b/README
index d343d2a..9c59f3a 100644
--- a/README
+++ b/README
@@ -53,7 +53,7 @@ ready-formatted plain text (chrony.txt) in the distribution.
There is also information available on the chrony web pages, accessible
through the URL
- http://chrony.tuxfamily.org/
+ https://chrony.tuxfamily.org/
Where are new versions announced?
=================================
@@ -84,6 +84,12 @@ chrony-dev-request@chrony.tuxfamily.org
as applicable.
+When you are reporting a bug, please send us all the information you can.
+Unfortunately, chrony has proven to be one of those programs where it is very
+difficult to reproduce bugs in a different environment. So we may have to
+interact with you quite a lot to obtain enough extra logging and tracing to
+pin-point the problem in some cases. Please be patient and plan for this!
+
License
=======
@@ -105,6 +111,10 @@ Miroslav Lichvar <mlichvar@redhat.com>
Acknowledgements
================
+In writing the chronyd program, extensive use has been made of RFC 1305
+and RFC 5905, written by David Mills. The source code of the NTP reference
+implementation has been used to check the details of the protocol.
+
The following people have provided patches and other major contributions
to the program :
@@ -131,6 +141,7 @@ Erik Bryer <ebryer@spots.ab.ca>
Bryan Christianson <bryan@whatroute.net>
Support for Mac OS X
Support for privilege separation
+ Entries in contrib directory
Juliusz Chroboczek <jch@pps.jussieu.fr>
Fix install rule in Makefile if chronyd file is in use.
@@ -217,6 +228,9 @@ Andreas Piesk <apiesk@virbus.de>
Timo Teras <timo.teras@iki.fi>
Patch to reply correctly on multihomed hosts
+Stephen Wadeley <swadeley@redhat.com>
+ Improvements to man pages
+
Wolfgang Weisselberg <weissel@netcologne.de>
Entries in contrib directory
diff --git a/candm.h b/candm.h
index 7d39417..05daaeb 100644
--- a/candm.h
+++ b/candm.h
@@ -93,11 +93,8 @@
#define REQ_REFRESH 53
#define REQ_SERVER_STATS 54
#define REQ_CLIENT_ACCESSES_BY_INDEX2 55
-#define N_REQUEST_TYPES 56
-
-/* Special utoken value used to log on with first exchange being the
- password. (This time value has long since gone by) */
-#define SPECIAL_UTOKEN 0x10101010
+#define REQ_LOCAL2 56
+#define N_REQUEST_TYPES 57
/* Structure used to exchange timevals independent on size of time_t */
typedef struct {
@@ -215,6 +212,8 @@ typedef struct {
typedef struct {
int32_t on_off;
int32_t stratum;
+ Float distance;
+ int32_t orphan;
int32_t EOR;
} REQ_Local;
diff --git a/chrony.conf.5.in b/chrony.conf.5.in
deleted file mode 100644
index 7756d66..0000000
--- a/chrony.conf.5.in
+++ /dev/null
@@ -1,67 +0,0 @@
-.TH chrony.conf 5 "February 2016" "chrony 2.3" "Configuration Files"
-.SH NAME
-chrony.conf \- chronyd configuration file
-
-.SH SYNOPSIS
-.B @SYSCONFDIR@/chrony.conf
-
-.SH DESCRIPTION
-\fIchrony\fR is a pair of programs for maintaining the accuracy of computer
-clocks. \fIchronyd\fR is a background daemon program that can be started at
-boot time.
-
-Assuming that you have found some servers, you need to set up a
-configuration file to run \fIchrony\fR. The (compiled-in) default location
-for this file is \fB@SYSCONFDIR@/chrony.conf\fR. Assuming that your NTP
-servers are called `foo.example.net', `bar.example.net' and `baz.example.net',
-your \fBchrony.conf\fR file could contain as a minimum
-
-.EX
- server foo.example.net
- server bar.example.net
- server baz.example.net
-.EE
-
-However, you will probably want to include some of the other directives
-described in detail in the documentation supplied with the distribution
-(\fIchrony.txt\fR and \fIchrony.texi\fR). The following directives may be
-particularly useful : `driftfile', `makestep', `rtcsync'. Also, the `iburst'
-server option is useful to speed up the initial synchronization. The smallest
-useful configuration file would look something like
-
-.EX
- server foo.example.net iburst
- server bar.example.net iburst
- server baz.example.net iburst
- driftfile @CHRONYVARDIR@/drift
- makestep 1.0 3
- rtcsync
-.EE
-
-When using a pool of NTP servers (one name is used for multiple servers which
-may change over time), it's better to specify them with the `pool' directive
-instead of multiple `server' directives. The configuration file could in this
-case look like
-
-.EX
- pool pool.ntp.org iburst
- driftfile @CHRONYVARDIR@/drift
- makestep 1.0 3
- rtcsync
-.EE
-
-.SH "SEE ALSO"
-.BR chronyc(1),
-.BR chronyd(8)
-
-.I http://chrony.tuxfamily.org/
-
-.SH AUTHOR
-Richard Curnow <rc@rc0.org.uk>
-
-This man-page was written by Jan Schaumann <jschauma@netmeister.org> as part of "The Missing
-Man Pages Project". Please see \fIhttp://www.netmeister.org/misc/m2p2/index.html\fR
-for details.
-
-The complete chrony documentation is supplied in texinfo format.
-
diff --git a/chrony.texi.in b/chrony.texi.in
deleted file mode 100644
index 099fc80..0000000
--- a/chrony.texi.in
+++ /dev/null
@@ -1,5216 +0,0 @@
-\input texinfo
-@c {{{ Main header stuff
-@afourwide
-@paragraphindent 0
-@setfilename chrony.info
-@settitle User guide for the chrony suite version @CHRONY_VERSION@
-@c @setchapternewpage off
-
-@ifinfo
-@dircategory Net Utilities
-@direntry
-* chrony: (chrony). How to use chronyd and chronyc
-* chronyd: (chrony)Starting chronyd. Reference for chronyd
-* chronyc: (chrony)Running chronyc. Reference for chronyc
-@end direntry
-@end ifinfo
-
-@titlepage
-@sp 10
-@title The chrony suite
-@subtitle This manual describes how to use
-@subtitle the programs chronyd and chronyc
-@author Richard P. Curnow
-@page
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1997-1999 Richard P. Curnow
-Copyright @copyright{} 2009-2015 Miroslav Lichvar
-@end titlepage
-@c }}}
-@c {{{ Top node
-@node Top
-@top
-@menu
-* Introduction:: What the chrony suite does
-* Installation:: How to compile and install the software
-* Typical scenarios:: How to configure the software for some common cases
-* Usage reference:: Reference manual
-* GPL:: The GNU General Public License
-@end menu
-@c }}}
-@c {{{ Ch:Introduction
-@c {{{ Chapter top
-@node Introduction
-@chapter Introduction
-@menu
-* Overview:: What the programs do
-* Acknowledgements:: Credit where credit is due
-* Availability:: Where to get the software
-* Other time synchronisation packages:: Comparision with other software
-* Distribution and warranty:: There is no warranty
-* Bug reporting:: How to report bugs and make suggestions
-@end menu
-@c }}}
-@c {{{ S:Overview
-@node Overview
-@section Overview
-chrony is a versatile implementation of the Network Time Protocol (NTP).
-It can synchronize the system clock with NTP servers, reference clocks
-(e.g. GPS receiver), and manual input using wristwatch and keyboard.
-It can also operate as an NTPv4 (RFC 5905) server and peer to provide
-a time service to other computers in the network.
-
-It is designed to perform well in a wide range of conditions, including
-intermittent network connections, heavily congested networks, changing
-temperatures (ordinary computer clocks are sensitive to temperature),
-and systems that do not run continuosly, or run on a virtual machine.
-
-Typical accuracy between two machines on a LAN is in tens, or a few
-hundreds, of microseconds; over the Internet, accuracy is typically
-within a few milliseconds. With a good hardware reference clock
-sub-microsecond accuracy is possible.
-
-Two programs are included in chrony, @code{chronyd} is a daemon that can
-be started at boot time and @code{chronyc} is a command-line interface
-program which can be used to monitor @code{chronyd}'s performance and to
-change various operating parameters whilst it is running.
-
-The IP addresses from which @code{chronyc} clients may connect can be tightly
-controlled. The default is just the computer that @code{chronyd} itself is
-running on.
-@c }}}
-@c {{{ S:Acknowledgments
-@node Acknowledgements
-@section Acknowledgements
-
-The @code{chrony} suite makes use of the algorithm known as @emph{RSA
-Data Security, Inc. MD5 Message-Digest Algorithm} for authenticating
-messages between different machines on the network.
-
-In writing the @code{chronyd} program, extensive use has been made of
-RFC 1305 and RFC 5905, written by David Mills. The source code of
-the NTP reference implementation has been used to check details of the
-protocol.
-@c }}}
-@c {{{ S:Availability
-@node Availability
-@section Availability
-@menu
-* Getting the software:: Where can I get the software from?
-* Platforms:: Which platforms will it run on?
-@end menu
-
-
-@node Getting the software
-@subsection Getting the software
-Links on @uref{http://chrony.tuxfamily.org, the chrony home page}
-describe how to obtain the software.
-
-
-@node Platforms
-@subsection Platforms
-Although most of the program is portable between
-Unix-like systems, there are parts that have to be tailored to each
-specific vendor's system. These are the parts that interface with the
-operating system's facilities for adjusting the system clock;
-different operating systems may provide different function calls to
-achieve this, and even where the same function is used it may have
-different quirks in its behaviour.
-
-The software is known to work on Linux, FreeBSD, NetBSD, Mac OS X and Solaris.
-Closely related systems may work too. Porting the software to other systems
-(particularly to those supporting an @code{adjtime} or @code{ntp_adjtime}
-system call) should not be difficult, however it requires access to such
-systems to test out the driver.
-@c }}}
-@c {{{ S:Other programs
-@node Other time synchronisation packages
-@section Relationship to other software packages
-@menu
-* Comparison with ntpd::
-* Comparison with timed::
-@end menu
-
-@node Comparison with ntpd
-@subsection ntpd
-The `reference' implementation of the Network Time Protocol is the
-program @code{ntpd}, available via
-@uref{http://www.ntp.org/, The NTP home page}.
-
-One of the main differences between @code{ntpd} and @code{chronyd} is in how
-they control the computer's clock. Things @code{chronyd} can do better than
-@code{ntpd}:
-
-@itemize @bullet
-@item
-@code{chronyd} can perform usefully in an environment where access to
-the time reference is intermittent. @code{ntpd} needs regular polling
-of the reference to work well.
-@item
-@code{chronyd} can usually synchronise the clock faster and with better
-time accuracy.
-@item
-@code{chronyd} quickly adapts to sudden changes in the rate of the clock
-(e.g. due to changes in the temperature of the crystal oscillator).
-@code{ntpd} may need a long time to settle down again.
-@item
-@code{chronyd} can perform well even when the network is congested for
-longer periods of time.
-@item
-@code{chronyd} in the default configuration never steps the time to not
-upset other running programs. @code{ntpd} can be configured to never
-step the time too, but in that case it has to use a different means of
-adjusting the clock (daemon loop instead of kernel discipline), which may
-have a negative effect on accuracy of the clock.
-@item
-@code{chronyd} can adjust the rate of the clock in a larger range, which
-allows it to operate even on machines with broken or unstable clock
-(e.g. in some virtual machines).
-@item
-@code{chronyd} is smaller, it uses less memory and it wakes up the CPU only
-when necessary, which is better for power saving.
-@end itemize
-
-Things @code{chronyd} can do that @code{ntpd} can't:
-
-@itemize @bullet
-@item
-@code{chronyd} provides support for isolated networks whether the only
-method of time correction is manual entry (e.g. by the administrator
-looking at a clock). @code{chronyd} can look at the errors corrected at
-different updates to work out the rate at which the computer gains or
-loses time, and use this estimate to trim the computer clock
-subsequently.
-
-@item
-@code{chronyd} provides support to work out the gain or loss rate of the
-`real-time clock', i.e. the clock that maintains the time when the
-computer is turned off. It can use this data when the system boots to
-set the system time from a corrected version of the real-time clock.
-These real-time clock facilities are only available on Linux, so far.
-@end itemize
-
-Things @code{ntpd} can do that @code{chronyd} can't:
-
-@itemize @bullet
-@item
-@code{ntpd} supports all operating modes from RFC 5905, including broadcast,
-multicast, and manycast server/client. However, the broadcast and multicast
-modes are inherently less accurate and less secure (even with authentication)
-than the ordinary server/client mode and should generally be avoided.
-
-@item
-@code{ntpd} supports the Autokey protocol (RFC 5906) to authenticate servers
-with public-key cryptography. Note that the protocol has been shown to be
-insecure and it will be probably replaced with an implementation of the Network
-Time Security (NTS) specification.
-
-@item
-@code{ntpd} supports the orphan mode, which allows synchronisation to a common
-timescale in isolated networks with multiple servers. With @code{chronyd}
-there can be only one master and all other computers have to be directly or
-indirectly synchronised to it.
-
-@item
-@code{ntpd} has been ported to more operating systems.
-
-@item
-@code{ntpd} includes a large number of reference clock drivers. @code{chronyd}
-relies on other programs (e.g. @code{gpsd}) to access the timing data via the
-@code{SHM} or @code{SOCK} driver.
-@end itemize
-
-A comparison of NTP implementations that includes more features and also
-their performance is on the @uref{http://chrony.tuxfamily.org/comparison.html,
-chrony comparison} page.
-
-@node Comparison with timed
-@subsection timed
-@code{timed} is a program that is part of the BSD networking suite. It
-uses broadcast packets to find all machines running the daemon within a
-subnet. The machines elect a master which periodically measures the
-system clock offsets of the other computers using ICMP timestamps.
-Corrections are sent to each member as a result of this process.
-
-Problems that may arise with @code{timed} are :
-
-@itemize @bullet
-@item
-Because it uses broadcasts, it is not possible to isolate its
-functionality to a particular group of computers; there is a risk of
-upsetting other computers on the same network (e.g. where a whole
-company is on the same subnet but different departments are independent
-from the point of view of administering their computers.)
-@item
-The update period appears to be 10 minutes. Computers can build up
-significant offsets relative to each other in that time. If a
-computer can estimate its rate of drift it can keep itself closer to
-the other computers between updates by adjusting its clock every few
-seconds. @code{timed} does not seem to do this.
-@item
-@code{timed} does not have any integrated capability for feeding
-real-time into its estimates, or for estimating the average rate of time
-loss/gain of the machines relative to real-time (unless one of the
-computers in the group has access to an external reference and is always
-appointed as the `master').
-@end itemize
-
-@code{timed} does have the benefit over @code{chronyd} that for isolated
-networks of computers, they will track the `majority vote' time. For
-such isolated networks, @code{chronyd} requires one computer to be the
-`master' with the others slaved to it. If the master has a particular
-defective clock, the whole set of computers will tend to slip relative
-to real time (but they @emph{will} stay accurate relative to one
-another).
-@c }}}
-@c {{{ S:Rights + warranty
-@node Distribution and warranty
-@section Distribution rights and (lack of) warranty
-
-Chrony may be distributed in accordance with the GNU General Public License
-version 2, reproduced in @xref{GPL}.
-
-@c }}}
-@c {{{ S:Bug reporting + suggestions
-@node Bug reporting
-@section Bug reporting and suggestions
-
-If you think you've found a bug in chrony, or have a suggestion, please let us
-know. You can join chrony users mailing list by sending a message with the
-subject subscribe to @email{chrony-users-request@@chrony.tuxfamily.org}. Only
-subscribers can post to the list.
-
-When you are reporting a bug, please send us all the information you can.
-Unfortunately, chrony has proven to be one of those programs where it is very
-difficult to reproduce bugs in a different environment. So we may have to
-interact with you quite a lot to obtain enough extra logging and tracing to
-pin-point the problem in some cases. Please be patient and plan for this!
-
-Of course, if you can debug the problem yourself and send us a source code
-patch to fix it, we will be very grateful!
-
-@c }}}
-@c }}}
-@c {{{ Ch:Installation
-@node Installation
-@chapter Installation
-
-@c {{{ main introduction text
-The software is distributed as source code which has to be compiled.
-The source code is supplied in the form of a gzipped tar file, which
-unpacks to a subdirectory identifying the name and version of the
-program.
-
-After unpacking the source code, change directory into it, and type
-
-@example
-./configure
-@end example
-
-This is a shell script that automatically determines the system type.
-There is a single optional parameter, @code{--prefix} which indicates
-the directory tree where the software should be installed. For example,
-
-@example
-./configure --prefix=/opt/free
-@end example
-
-will install the @code{chronyd} daemon into /opt/free/sbin and the
-@code{chronyc} control program into /opt/free/bin. The default value for the
-prefix is /usr/local.
-
-The configure script assumes you want to use gcc as your compiler.
-If you want to use a different compiler, you can configure this way:
-
-@example
-CC=cc CFLAGS=-O ./configure --prefix=/opt/free
-@end example
-
-for Bourne-family shells, or
-
-@example
-setenv CC cc
-setenv CFLAGS -O
-./configure --prefix=/opt/free
-@end example
-
-for C-family shells.
-
-If the software cannot (yet) be built on your system, an error message
-will be shown. Otherwise, @file{Makefile} will be generated.
-
-On Linux, if development files for the libcap library are available,
-@code{chronyd} will be built with support for dropping root privileges.
-On other systems no extra library is needed. The default user which
-@code{chronyd} should run as can be specified with the @code{--with-user}
-option of the configure script.
-
-If development files for the editline or readline library are available,
-@code{chronyc} will be built with line editing support. If you don't want
-this, specify the --disable-readline flag to configure. Please refer to
-@pxref{line editing support} for more information.
-
-If a @file{timepps.h} header is available (e.g. from the
-@uref{http://linuxpps.org/, LinuxPPS project}), @code{chronyd} will be built with PPS API
-reference clock driver. If the header is installed in a location that isn't
-normally searched by the compiler, you can add it to the searched locations by
-setting @code{CPPFLAGS} variable to @code{-I/path/to/timepps}.
-
-Now type
-
-@example
-make
-@end example
-
-to build the programs.
-
-If you want to build the manual in plain text, HTML and info versions, type
-
-@example
-make docs
-@end example
-
-Once the programs have been successfully compiled, they need to be
-installed in their target locations. This step normally needs to be
-performed by the superuser, and requires the following command to be
-entered.
-
-@example
-make install
-@end example
-
-This will install the binaries and manpages.
-
-To install the plain text, HTML and info versions of the manual, enter the
-command
-
-@example
-make install-docs
-@end example
-
-If you want chrony to appear in the top level info directory listing, you need
-to run the @command{install-info} command manually after this step.
-@command{install-info} takes 2 arguments. The first is the path to the
-@file{chrony.info} file you have just installed. This will be the argument you
-gave to --prefix when you configured (@file{/usr/local} by default), with
-@file{/share/info/chrony.info} on the end. The second argument is the location of
-the file called @file{dir}. This will typically be @file{/usr/share/info/dir}. So
-the typical command line would be
-
-@example
-install-info /usr/local/share/info/chrony.info /usr/share/info/dir
-@end example
-
-Now that the software is successfully installed, the next step is to
-set up a configuration file. The default location of the file
-is @file{@SYSCONFDIR@/chrony.conf}. Several examples of configuration with
-comments are included in the examples directory. Suppose you want to use
-public NTP servers from the pool.ntp.org project as your time reference. A
-minimal useful configuration file could be
-
-@example
-pool pool.ntp.org iburst
-makestep 1.0 3
-rtcsync
-@end example
-
-Then, @code{chronyd} can be run. For security reasons, it's recommended to
-create an unprivileged user for @code{chronyd} and specify it with the
-@code{-u} command-line option or the @code{user} directive in the configuration
-file, or set the default user with the @code{--with-user} configure option
-before building.
-@c }}}
-@menu
-* line editing support:: If libraries are in a non-standard place
-* package builders:: Extra options useful to package builders
-@end menu
-@c {{{ line editing support
-@node line editing support
-@section Support for line editing libraries
-Chronyc can be built with support for line editing, this allows you to use the
-cursor keys to replay and edit old commands. Two libraries are supported which
-provide such functionality, editline and GNU readline.
-
-Please note that readline since version 6.0 is licensed under GPLv3+ which is
-incompatible with chrony's license GPLv2. You should use editline instead if
-you don't want to use older readline versions.
-
-The configure script will automatically enable the line editing support if one
-of the supported libraries is available. If they are both available, the
-editline library will be used.
-
-If you don't want to use it (in which case chronyc will use a minimal command
-line interface), invoke configure like this:
-
-@example
-./configure --disable-readline other-options...
-@end example
-
-If you have editline, readline or ncurses installed in locations that aren't
-normally searched by the compiler and linker, you need to use extra options:
-
-@table @samp
-@item --with-readline-includes=directory_name
-This defines the name of the directory above the one where @file{readline.h}
-is. @file{readline.h} is assumed to be in @file{editline} or @file{readline}
-subdirectory of the named directory.
-
-@item --with-readline-library=directory_name
-This defines the directory containing the @file{libedit.a} or @file{libedit.so}
-file, or @file{libreadline.a} or @file{libreadline.so} file.
-
-@item --with-ncurses-library=directory_name
-This defines the directory containing the @file{libncurses.a} or
-@file{libncurses.so} file.
-@end table
-
-@c }}}
-@c {{{
-@node package builders
-@section Extra options for package builders
-The configure and make procedures have some extra options that may be useful if
-you are building a distribution package for chrony.
-
-The --infodir=DIR option to configure specifies an install directory
-for the info files. This overrides the @file{info} subdirectory of the
-argument to the --prefix option. For example, you might use
-
-@example
-./configure --prefix=/usr --infodir=/usr/share/info
-@end example
-
-The --mandir=DIR option to configure specifies an install directory
-for the man pages. This overrides the @file{man} subdirectory of the
-argument to the --prefix option.
-
-@example
-./configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man
-@end example
-
-to set both options together.
-
-The final option is the DESTDIR option to the make command. For example, you
-could use the commands
-
-@example
-./configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man
-make all docs
-make install DESTDIR=./tmp
-cd tmp
-tar cvf - . | gzip -9 > chrony.tar.gz
-@end example
-
-to build a package. When untarred within the root directory, this will install
-the files to the intended final locations.
-
-@c }}}
-
-@c }}}
-@c {{{ Ch:Typical operating scenarios
-@c {{{ Chapter top
-@node Typical scenarios
-@chapter Typical operating scenarios
-@menu
-* Computers on the net:: Your computer is on the Internet most of the time
- (or on a private network with NTP servers)
-* Infrequent connection:: You connect to the Internet sometimes (e.g. via a modem)
-* Isolated networks:: You have an isolated network with no reference clocks
-* Dial-up home PCs:: Additional considerations if you turn your computer off
- when it's not in use
-* Configuration options overview:: Overview of some configuration options
-@end menu
-@c }}}
-@c {{{ S:Permanent connection
-@node Computers on the net
-@section Computers connected to the internet
-In this section we discuss how to configure chrony for computers that
-are connected to the Internet (or to any network containing true NTP
-servers which ultimately derive their time from a reference clock)
-permanently or most of the time.
-
-To operate in this mode, you will need to know the names of the NTP
-server machines you wish to use. You may be able to find names of
-suitable servers by one of the following methods:
-
-@itemize @bullet
-@item Your institution may already operate servers on its network.
-Contact your system administrator to find out.
-
-@item Your ISP probably has one or more NTP servers available for its
-customers.
-
-@item Somewhere under the NTP homepage there is a list of public
-stratum 1 and stratum 2 servers. You should find one or more servers
-that are near to you --- check that their access policy allows you to
-use their facilities.
-
-@item Use public servers from
-@uref{http://www.pool.ntp.org/, the pool.ntp.org project}.
-@end itemize
-
-Assuming that you have found some servers, you need to set up a
-configuration file to run chrony. The (compiled-in) default location
-for this file is @file{@SYSCONFDIR@/chrony.conf}. Assuming that your NTP
-servers are called @code{foo.example.net}, @code{bar.example.net} and
-@code{baz.example.net}, your @file{chrony.conf} file could contain as a minimum
-
-@example
-server foo.example.net
-server bar.example.net
-server baz.example.net
-@end example
-
-However, you will probably want to include some of the other directives
-described later. The following directives may be particularly useful :
-@code{driftfile}, @code{makestep}, @code{rtcsync}. Also, the @code{iburst}
-server option is useful to speed up the initial synchronization. The smallest
-useful configuration file would look something like
-
-@example
-server foo.example.net iburst
-server bar.example.net iburst
-server baz.example.net iburst
-driftfile @CHRONYVARDIR@/drift
-makestep 1.0 3
-rtcsync
-@end example
-
-When using a pool of NTP servers (one name is used for multiple servers which
-may change over time), it's better to specify them with the @code{pool}
-directive instead of multiple @code{server} directives. The configuration file
-could in this case look like
-
-@example
-pool pool.ntp.org iburst
-driftfile @CHRONYVARDIR@/drift
-makestep 1.0 3
-rtcsync
-@end example
-@c }}}
-@c {{{ S:Infrequent connection
-@node Infrequent connection
-@section Infrequent connection to true NTP servers
-In this section we discuss how to configure chrony for computers that
-have occasional connections to the internet.
-
-@menu
-* Configuration for infrequent connections:: How to set up the @code{@SYSCONFDIR@/chrony.conf} file
-* Advising chronyd of internet availability:: How to tell chronyd when the link is available
-@end menu
-
-@node Configuration for infrequent connections
-@subsection Setting up the configuration file for infrequent connections
-As in the previous section, you will need access to NTP servers on the
-internet. The same remarks apply for how to find them.
-
-In this case, you will need some additional configuration to tell
-@code{chronyd} when the connection to the internet goes up and down.
-This saves the program from continuously trying to poll the servers when
-they are inaccessible.
-
-Again, assuming that your NTP servers are called @code{foo.example.net},
-@code{bar.example.net} and @code{baz.example.net}, your @file{chrony.conf} file
-would need to contain something like
-
-@example
-server foo.example.net
-server bar.example.net
-server baz.example.net
-@end example
-
-However, your computer will keep trying to contact the servers to obtain
-timestamps, even whilst offline. If you operate a dial-on-demand
-system, things are even worse, because the link to the internet will
-keep getting established.
-
-For this reason, it would be better to specify this part of your
-configuration file in the following way:
-
-@example
-server foo.example.net offline
-server bar.example.net offline
-server baz.example.net offline
-@end example
-
-The @code{offline} keyword indicates that the servers start in an offline
-state, and that they should not be contacted until @code{chronyd} receives
-notification from @code{chronyc} that the link to the internet is present.
-
-The smallest useful configuration file would look something like
-
-@example
-server foo.example.net offline
-server bar.example.net offline
-server baz.example.net offline
-driftfile @CHRONYVARDIR@/drift
-makestep 1.0 3
-rtcsync
-@end example
-
-The next section describes how to tell @code{chronyd} when the internet link
-goes up and down.
-
-@node Advising chronyd of internet availability
-@subsection How to tell chronyd when the internet link is available.
-To tell @code{chronyd} when to start and finish sampling the servers, the
-@code{online} and @code{offline} commands of @code{chronyc} need to be used.
-To give an example of their use, we assume that @code{pppd} is the
-program being used to connect to the internet, and that @code{chronyc} has been
-installed at its default location @file{@BINDIR@/chronyc}.
-
-In the file @file{/etc/ppp/ip-up} we add the command sequence
-
-@example
-@BINDIR@/chronyc online
-@end example
-
-and in the file @file{/etc/ppp/ip-down} we add the sequence
-
-@example
-@BINDIR@/chronyc offline
-@end example
-
-@code{chronyd's} polling of the servers will now only occur whilst the
-machine is actually connected to the Internet.
-@c }}}
-@c {{{ S:Isolated networks
-@node Isolated networks
-@section Isolated networks
-In this section we discuss how to configure chrony for computers that
-never have network conectivity to any computer which ultimately derives
-its time from a reference clock.
-
-In this situation, one computer is selected to be the master timeserver.
-The other computers are either direct clients of the master, or clients
-of clients.
-
-The rate value in the master's drift file needs to be set to the average
-rate at which the master gains or loses time. @code{chronyd} includes
-support for this, in the form of the @code{manual} directive in the
-configuration file and the @code{settime} command in the @code{chronyc}
-program.
-
-The @code{smoothtime} directive (@pxref{smoothtime directive}) is useful when
-the clocks of the clients need to stay close together when the local time is
-adjusted by the @code{settime} command. The smoothing process needs to be
-activated by the @code{smoothtime activate} command when the local time is
-ready to be served. After that point, any adjustments will be smoothed out.
-
-A typical configuration file for the master (called @code{master}) might be
-(assuming the clients are in the 192.168.165.x subnet)
-
-@example
-driftfile @CHRONYVARDIR@/drift
-local stratum 8
-manual
-allow 192.168.165
-smoothtime 400 0.01
-@end example
-
-For the clients the configuration file might be
-
-@example
-server master iburst
-driftfile @CHRONYVARDIR@/drift
-logdir /var/log/chrony
-log measurements statistics tracking
-@end example
-@c }}}
-@c {{{ S:Dial-up home PCs
-@node Dial-up home PCs
-@section The home PC with a dial-up connection
-
-@menu
-* Dial-up overview:: General discussion of how the software operates in this mode
-* Dial-up configuration:: Typical configuration files
-@end menu
-
-@node Dial-up overview
-@subsection Assumptions/how the software works
-This section considers the home computer which has a dial-up connection.
-It assumes that Linux is run exclusively on the computer. Dual-boot
-systems may work; it depends what (if anything) the other system does to
-the system's real-time clock.
-
-Much of the configuration for this case is discussed earlier
-(@pxref{Infrequent connection}). This section addresses specifically
-the case of a computer which is turned off between 'sessions'.
-
-In this case, @code{chronyd} relies on the computer's real-time clock
-(RTC) to maintain the time between the periods when it is powered up.
-The arrangement is shown in the figure below.
-
-@example
-@group
- trim if required PSTN
- +---------------------------+ +----------+
- | | | |
- v | | |
-+---------+ +-------+ +-----+ +---+
-| System's| measure error/ |chronyd| |modem| |ISP|
-|real-time|------------------->| |-------| | | |
-| clock | drift rate +-------+ +-----+ +---+
-+---------+ ^ |
- | | |
- +---------------------------+ --o-----o---
- set time at boot up |
- +----------+
- |NTP server|
- +----------+
-@end group
-@end example
-
-When the computer is connected to the Internet (via the modem),
-@code{chronyd} has access to external NTP servers which it makes
-measurements from. These measurements are saved, and straight-line fits
-are performed on them to provide an estimate of the computer's time
-error and rate of gaining/losing time.
-
-When the computer is taken offline from the Internet, the best estimate
-of the gain/loss rate is used to free-run the computer until it next
-goes online.
-
-Whilst the computer is running, @code{chronyd} makes measurements of the
-real-time clock (RTC) (via the @file{/dev/rtc} interface, which must be
-compiled into the kernel). An estimate is made of the RTC error at a
-particular RTC second, and the rate at which the RTC gains or loses time
-relative to true time.
-
-On 2.6 and later kernels, if your motherboard has a HPET, you need to enable the
-@samp{HPET_EMULATE_RTC} option in your kernel configuration. Otherwise, chrony
-will not be able to interact with the RTC device and will give up using it.
-
-When the computer is powered down, the measurement histories for all the
-NTP servers are saved to files (if the @code{dumponexit} directive is
-specified in the configuration file), and the RTC tracking information
-is also saved to a file (if the @code{rtcfile} directive has been
-specified). These pieces of information are also saved if the
-@code{dump} and @code{writertc} commands respectively are issued through
-@code{chronyc}.
-
-When the computer is rebooted, @code{chronyd} reads the current RTC time
-and the RTC information saved at the last shutdown. This information is
-used to set the system clock to the best estimate of what its time would
-have been now, had it been left running continuously. The measurement
-histories for the servers are then reloaded.
-
-The next time the computer goes online, the previous sessions'
-measurements can contribute to the line-fitting process, which gives a
-much better estimate of the computer's gain/loss rate.
-
-One problem with saving the measurements and RTC data when the machine
-is shut down is what happens if there is a power failure; the most
-recent data will not be saved. Although @code{chronyd} is robust enough
-to cope with this, some performance may be lost. (The main danger
-arises if the RTC has been changed during the session, with the
-@code{trimrtc} command in @code{chronyc}. Because of this,
-@code{trimrtc} will make sure that a meaningful RTC file is saved out
-after the change is completed).
-
-The easiest protection against power failure is to put the @code{dump}
-and @code{writertc} commands in the same place as the @code{offline}
-command is issued to take @code{chronyd} offline; because @code{chronyd}
-free-runs between online sessions, no parameters will change
-significantly between going offline from the Internet and any power
-failure.
-
-A final point regards home computers which are left running for extended
-periods and where it is desired to spin down the hard disc when it is
-not in use (e.g. when not accessed for 15 minutes). @code{chronyd} has
-been planned so it supports such operation; this is the reason why the
-RTC tracking parameters are not saved to disc after every update, but
-only when the user requests such a write, or during the shutdown
-sequence. The only other facility that will generate periodic writes to
-the disc is the @code{log rtc} facility in the configuration file; this
-option should not be used if you want your disc to spin down.
-
-@node Dial-up configuration
-@subsection Typical configuration files.
-
-To illustrate how a dial-up home computer might be configured, example
-configuration files are shown in this section.
-
-For the @file{@SYSCONFDIR@/chrony.conf} file, the following can be used as an
-example.
-
-@example
-server foo.example.net maxdelay 0.4 offline
-server bar.example.net maxdelay 0.4 offline
-server baz.example.net maxdelay 0.4 offline
-logdir /var/log/chrony
-log statistics measurements tracking
-driftfile @CHRONYVARDIR@/drift
-makestep 1.0 3
-maxupdateskew 100.0
-dumponexit
-dumpdir @CHRONYVARDIR@
-rtcfile @CHRONYVARDIR@/rtc
-@end example
-
-@code{pppd} is used for connecting to the internet. This runs two scripts
-@file{/etc/ppp/ip-up} and @file{/etc/ppp/ip-down} when the link goes
-online and offline respectively.
-
-The relevant part of the @file{/etc/ppp/ip-up} file is
-
-@example
-@BINDIR@/chronyc online
-@end example
-
-and the relevant part of the @file{/etc/ppp/ip-down} script is
-
-@example
-@BINDIR@/chronyc -m offline dump writertc
-@end example
-
-To start @code{chronyd} during the boot sequence, the following
-is in @file{/etc/rc.d/rc.local} (this is a Slackware system)
-
-@example
-if [ -f @SBINDIR@/chronyd -a -f @SYSCONFDIR@/chrony.conf ]; then
- @SBINDIR@/chronyd -r -s
- echo "Start chronyd"
-fi
-@end example
-
-The placement of this command may be important on some systems. In
-particular, @code{chronyd} may need to be started before any software
-that depends on the system clock not jumping or moving backwards,
-depending on the directives in @code{chronyd's} configuration file.
-
-For the system shutdown, @code{chronyd} should receive a SIGTERM several
-seconds before the final SIGKILL; the SIGTERM causes the measurement
-histories and RTC information to be saved out.
-@c }}}
-@c {{{ S:Other config options
-@node Configuration options overview
-@section Other important configuration options
-The most common option to include in the configuration file is the
-@code{driftfile} option. One of the major tasks of @code{chronyd} is to
-work out how fast or how slow the system clock runs relative to real
-time - e.g. in terms of seconds gained or lost per day. Measurements
-over a long period are usually required to refine this estimate to an
-acceptable degree of accuracy. Therefore, it would be bad if
-@code{chronyd} had to work the value out each time it is restarted,
-because the system clock would not run so accurately whilst the
-determination is taking place.
-
-To avoid this problem, @code{chronyd} allows the gain or loss rate to be
-stored in a file, which can be read back in when the program is
-restarted. This file is called the drift file, and might typically be
-stored in @file{@CHRONYVARDIR@/drift}. By specifying an option like the
-following
-
-@example
-driftfile @CHRONYVARDIR@/drift
-@end example
-
-in the configuration file (@file{@SYSCONFDIR@/chrony.conf}), the drift file
-facility will be activated.
-@c }}}
-@c }}}
-@c {{{ Ch:Usage reference
-@node Usage reference
-@chapter Usage reference
-
-@c {{{ Chapter top
-@menu
-* Starting chronyd:: Command line options for the daemon
-* Configuration file:: Format of the configuration file
-* Running chronyc:: The run-time configuration program
-@end menu
-@c }}}
-@c {{{ S:Starting chronyd
-@node Starting chronyd
-@section Starting chronyd
-If @code{chronyd} has been installed to its default location
-@file{@SBINDIR@/chronyd}, starting it is simply a matter of
-entering the command
-
-@example
-@SBINDIR@/chronyd
-@end example
-
-Information messages and warnings will be logged to syslog.
-
-If no configuration commands are specified on the command line,
-@code{chronyd} will read the commands from the configuration file
-(default @file{@SYSCONFDIR@/chrony.conf}).
-
-The command line options supported are as follows:
-
-@table @code
-@item -n
-When run in this mode, the program will not detach itself from the
-terminal.
-@item -d
-When run in this mode, the program will not detach itself from the
-terminal, and all messages will be sent to the terminal instead of to
-syslog. When @code{chronyd} was compiled with debugging support,
-this option can be used twice to print also debugging messages.
-@item -f <conf-file>
-This option can be used to specify an alternate location for the
-configuration file (default @file{@SYSCONFDIR@/chrony.conf}).
-@item -r
-This option will reload sample histories for each of the servers and refclocks being
-used. These histories are created by using the @code{dump} command in
-@code{chronyc}, or by setting the @code{dumponexit} directive in the
-configuration file. This option is useful if you want to stop and
-restart @code{chronyd} briefly for any reason, e.g. to install a new
-version. However, it should be used only on systems where the kernel
-can maintain clock compensation whilst not under @code{chronyd's}
-control (i.e. Linux, FreeBSD, NetBSD and Solaris).
-@item -R
-When this option is used, the @code{initstepslew} directive and the
-@code{makestep} directive used with a positive limit will be ignored.
-This option is useful when restarting @code{chronyd} and can be used
-in conjunction with the `-r' option.
-
-@item -s
-This option will set the system clock from the computer's real-time clock or
-to the last modification time of the file specified by the @code{driftfile}
-directive. Real-time clocks are supported only on Linux.
-
-If used in conjunction with the `-r' flag, @code{chronyd} will attempt
-to preserve the old samples after setting the system clock from the real
-time clock (RTC). This can be used to allow @code{chronyd} to perform long
-term averaging of the gain or loss rate across system reboots, and is
-useful for dial-up systems that are shut down when not in use. For this
-to work well, it relies on @code{chronyd} having been able to determine
-accurate statistics for the difference between the RTC and
-system clock last time the computer was on.
-
-If the last modification time of the drift file is later than the current time
-and the RTC time, the system time will be set to it to restore the time when
-@code{chronyd} was previously stopped. This is useful on computers that have
-no RTC or the RTC is broken (e.g. it has no battery).
-@item -u <user>
-This option sets the name of the system user to which @code{chronyd} will
-switch after start in order to drop root privileges. It overrides the
-@code{user} directive (default @code{@DEFAULT_USER@}).
-
-On Linux, @code{chronyd} needs to be compiled with support for the
-@code{libcap} library. On Mac OS X, FreeBSD, NetBSD and Solaris @code{chronyd}
-forks into two processes. The child process retains root privileges, but can
-only perform a very limited range of privileged system calls on behalf of the
-parent.
-@item -F <level>
-This option configures a system call filter when @code{chronyd} is compiled with
-support for the Linux secure computing (seccomp) facility. In level 1 the
-process is killed when a forbidden system call is made, in level -1 the SYSSIG
-signal is thrown instead and in level 0 the filter is disabled (default 0).
-
-It's recommended to enable the filter only when it's known to work on the
-version of the system where @code{chrony} is installed as the filter needs to
-allow also system calls made from libraries that @code{chronyd} is using (e.g.
-libc) and different versions or implementations of the libraries may make
-different system calls. If the filter is missing some system call,
-@code{chronyd} could be killed even in normal operation.
-@item -q
-When run in this mode, @code{chronyd} will set the system clock once
-and exit. It will not detach from the terminal.
-@item -Q
-This option is similar to `-q', but it will only print the offset and
-not correct the clock.
-@item -v
-This option displays @code{chronyd's} version number to the terminal and
-exits.
-@item -P <priority>
-On Linux, this option will select the SCHED_FIFO real-time scheduler at the
-specified priority (which must be between 0 and 100). On Mac OS X, this option
-must have either a value of 0 (the default) to disable the thread time
-constraint policy or 1 for the policy to be enabled. Other systems do not
-support this option.
-@item -m
-This option will lock chronyd into RAM so that it will never be paged
-out. This mode is only supported on Linux.
-@item -4
-With this option hostnames will be resolved only to IPv4 addresses and only
-IPv4 sockets will be created.
-@item -6
-With this option hostnames will be resolved only to IPv6 addresses and only
-IPv6 sockets will be created.
-@end table
-
-On systems that support an @file{/etc/rc.local} file for starting
-programs at boot time, @code{chronyd} can be started from there.
-
-On systems with a System V style initialisation, a
-suitable start/stop script might be as shown below. This might be
-placed in the file @file{/etc/rc2.d/S83chrony}.
-
-@example
-@group
-#!/bin/sh
-# This file should have uid root, gid sys and chmod 744
-#
-
-killproc() @{ # kill the named process(es)
- pid=`/usr/bin/ps -e |
- /usr/bin/grep -w $1 |
- /usr/bin/sed -e 's/^ *//' -e 's/ .*//'`
- [ "$pid" != "" ] && kill $pid
-@}
-
-case "$1" in
-
-'start')
- if [ -f /opt/free/sbin/chronyd -a -f @SYSCONFDIR@/chrony.conf ]; then
- /opt/free/sbin/chronyd
- fi
- ;;
-'stop')
- killproc chronyd
- ;;
-*)
- echo "Usage: /etc/rc2.d/S83chrony @{ start | stop @}"
- ;;
-esac
-@end group
-@end example
-
-(In both cases, you may want to bear in mind that @code{chronyd} can
-step the time when it starts. There may be other programs started at
-boot time that could be upset by this, so you may need to consider the
-ordering carefully. However, @code{chronyd} will need to start after
-daemons providing services that it may require, e.g. the domain name
-service.)
-@c }}}
-@c {{{ S:chronyd configuration file
-@node Configuration file
-@section The chronyd configuration file
-@c {{{ section top
-The configuration file is normally called @file{@SYSCONFDIR@/chrony.conf}; in
-fact, this is the compiled-in default. However, other locations can be
-specified with a command line option.
-
-Each command in the configuration file is placed on a separate line.
-The following sections describe each of the commands in turn. The
-directives can occur in any order in the file and they are not
-case-sensitive.
-
-The configuration commands can also be specified directly on the
-@code{chronyd} command line, each argument is parsed as a line and
-the configuration file is ignored.
-
-@menu
-* comments in config file:: How to write a comment
-* acquisitionport directive:: Set NTP client port
-* allow directive:: Give access to NTP clients
-* bindacqaddress directive:: Limit network interface used by NTP client
-* bindaddress directive:: Limit network interface used by NTP server
-* bindcmdaddress directive:: Limit network interface used for commands
-* broadcast directive:: Make chronyd act as an NTP broadcast server
-* clientloglimit directive:: Set client log memory limit
-* cmdallow directive:: Give monitoring access to chronyc on other computers
-* cmddeny directive:: Deny monitoring access to chronyc on other computers
-* cmdport directive:: Set port to use for runtime monitoring
-* cmdratelimit directive:: Limit command response rate
-* combinelimit directive:: Limit sources included in combining algorithm
-* corrtimeratio directive:: Set correction time ratio
-* deny directive:: Deny access to NTP clients
-* driftfile directive:: Specify location of file containing drift data
-* dumpdir directive:: Specify directory for dumping measurements
-* dumponexit directive:: Dump measurements when daemon exits
-* fallbackdrift directive:: Specify fallback drift intervals
-* hwclockfile directive:: Specify location of hwclock's adjtime file
-* include directive:: Include a configuration file
-* initstepslew directive:: Trim the system clock on boot-up
-* keyfile directive:: Specify location of file containing keys
-* leapsecmode directive:: Select leap second handling mode
-* leapsectz directive:: Read leap second data from tz database
-* local directive:: Allow unsynchronised machine to act as server
-* lock_all directive:: Require that chronyd be locked into RAM
-* log directive:: Make daemon log certain sets of information
-* logbanner directive:: Specify how often is banner written to log files
-* logchange directive:: Generate syslog messages if large offsets occur
-* logdir directive:: Specify directory for logging
-* mailonchange directive:: Send email if a clock correction above a threshold occurs
-* makestep directive:: Step system clock if large correction is needed
-* manual directive:: Allow manual entry using chronyc's settime cmd
-* maxchange directive:: Set maximum allowed offset
-* maxclockerror directive:: Set maximum frequency error of local clock
-* maxdistance directive:: Set maximum allowed distance of sources
-* maxsamples directive:: Set maximum number of samples per source
-* maxslewrate directive:: Set maximum slew rate
-* maxupdateskew directive:: Stop bad estimates upsetting machine clock
-* minsamples directive:: Set minimum number of samples per source
-* minsources directive:: Set minimum number of selectable sources to update clock
-* noclientlog directive:: Prevent chronyd from gathering data about clients
-* peer directive:: Specify an NTP peer
-* pidfile directive:: Specify the file where chronyd's pid is written
-* pool directive:: Specify an NTP pool
-* port directive:: Set NTP server port
-* ratelimit directive:: Limit NTP response rate
-* refclock directive:: Specify a reference clock
-* reselectdist directive:: Set improvement in distance needed to reselect a source
-* rtcautotrim directive:: Specify threshold at which RTC is trimmed automatically
-* rtcdevice directive:: Specify name of enhanced RTC device (if not /dev/rtc)
-* rtcfile directive:: Specify the file where real-time clock data is stored
-* rtconutc directive:: Specify that the real time clock keeps UTC not local time
-* rtcsync directive:: Specify that RTC should be automatically synchronised by kernel
-* sched_priority directive:: Require real-time scheduling and specify a priority for it
-* server directive:: Specify an NTP server
-* smoothtime directive:: Smooth served time to keep clients close together
-* stratumweight directive:: Specify how important is stratum when selecting source
-* tempcomp directive:: Specify temperature sensor and compensation coefficients
-* user directive:: Specify user for dropping root privileges
-
-@end menu
-@c }}}
-@c {{{ comments in config file
-@node comments in config file
-@subsection Comments in the configuration file
-The configuration file may contain comment lines. A comment line is any line
-that starts with zero or more spaces followed by any one of the following
-characters:
-@itemize
-@item !
-@item ;
-@item #
-@item %
-@end itemize
-Any line with this format will be ignored.
-@c }}}
-@c {{{ acquisitionport directive
-@node acquisitionport directive
-@subsection acquisitionport
-By default, @code{chronyd} uses a separate client socket for each configured
-server and their source port is chosen arbitrarily by the operating system.
-However, you can use the @code{acquisitionport} directive to explicitly specify
-a port and use only one socket (per IPv4/IPv6 address family) for all
-configured servers. This may be useful for getting through firewalls. If set
-to 0, the source port of the socket will be chosen arbitrarily.
-
-It may be set to the same port as used by the NTP server (@pxref{port
-directive}) to use only one socket for all NTP packets.
-
-An example of the @code{acquisitionport} command is
-
-@example
-acquisitionport 1123
-@end example
-
-This would change the source port used for client requests to udp/1123. You
-could then persuade the firewall administrator to let that port through.
-@c }}}
-@c {{{ allow
-@node allow directive
-@subsection allow
-The @code{allow} command is used to designate a particular subnet from
-which NTP clients are allowed to access the computer as an NTP server.
-
-The default is that no clients are allowed access, i.e. @code{chronyd}
-operates purely as an NTP client. If the @code{allow} directive is
-used, @code{chronyd} will be both a client of its servers, and a server
-to other clients.
-
-Examples of use of the command are as follows:
-
-@example
-allow foo.example.net
-allow 1.2
-allow 3.4.5
-allow 6.7.8/22
-allow 6.7.8.9/22
-allow 2001:db8::/32
-allow 0/0
-allow ::/0
-allow
-@end example
-
-The first command allows the named node to be an NTP client of this computer.
-The second command allows any node with an IPv4 address of the form 1.2.x.y (with
-x and y arbitrary) to be an NTP client of this computer. Likewise, the third
-command allows any node with an IPv4 address of the form 3.4.5.x to have client
-NTP access. The fourth and fifth forms allow access from any node with an IPv4
-address of the form 6.7.8.x, 6.7.9.x, 6.7.10.x or 6.7.11.x (with x arbitrary),
-i.e. the value 22 is the number of bits defining the specified subnet. (In the
-fifth form, the final byte is ignored). The sixth form is used for IPv6
-addresses. The seventh and eighth forms allow access by any IPv4 and IPv6 node
-respectively. The ninth forms allows access by any node (IPv4 or IPv6).
-
-A second form of the directive, @code{allow all}, has a greater effect,
-depending on the ordering of directives in the configuration file. To
-illustrate the effect, consider the two examples
-
-@example
-allow 1.2.3.4
-deny 1.2.3
-allow 1.2
-@end example
-
-and
-
-@example
-allow 1.2.3.4
-deny 1.2.3
-allow all 1.2
-@end example
-
-In the first example, the effect is the same regardles of what order the
-three directives are given in. So the 1.2.x.y subnet is allowed access,
-except for the 1.2.3.x subnet, which is denied access, however the host
-1.2.3.4 is allowed access.
-
-In the second example, the @code{allow all 1.2} directives overrides the
-effect of @emph{any} previous directive relating to a subnet within the
-specified subnet. Within a configuration file this capability is
-probably rather moot; however, it is of greater use for reconfiguration
-at run-time via @code{chronyc} (@pxref{allow all command}).
-
-Note, if the @code{initstepslew} directive (@pxref{initstepslew
-directive}) is used in the configuration file, each of the computers
-listed in that directive must allow client access by this computer for
-it to work.
-@c }}}
-@c {{{ bindacqaddress
-@node bindacqaddress directive
-@subsection bindacqaddress
-The @code{bindacqaddress} directive sets the network interface to which will
-@code{chronyd} bind its NTP client sockets. The syntax is similar to the
-@code{bindaddress} and @code{bindcmdaddress} directives.
-
-For each of IPv4 and IPv6 protocols, only one @code{bindacqaddress}
-directive can be specified.
-@c }}}
-@c {{{ bindaddress
-@node bindaddress directive
-@subsection bindaddress
-The @code{bindaddress} directive allows you to restrict the network interface
-to which @code{chronyd} will listen for NTP requests. This provides an
-additional level of access restriction above that available through the
-@code{deny} mechanism.
-
-Suppose you have a local ethernet with addresses in the 192.168.1.0
-subnet together with an internet connection. The ethernet interface's IP
-address is 192.168.1.1. Suppose you want to block all access through the
-internet connection. You could add the line
-
-@example
-bindaddress 192.168.1.1
-@end example
-
-to the configuration file.
-
-For each of IPv4 and IPv6 protocols, only one @code{bindaddress} directive can
-be specified. Therefore, it's not useful on computers which should serve NTP
-on multiple network interfaces.
-@c }}}
-@c {{{ bindcmdaddress
-@node bindcmdaddress directive
-@subsection bindcmdaddress
-The @code{bindcmdaddress} directive allows you to specify the network
-interface to which @code{chronyd} will listen for monitoring command packets
-(issued by @code{chronyc}). This provides an additional level of access
-restriction above that available through @code{cmddeny} mechanism.
-
-This directive can also change the path of the Unix domain command socket,
-which is used by @code{chronyc} to send configuration commands. The socket
-must be in a directory that is accessible only by the root or chrony user. The
-directory will be created on start if it doesn't exist. The default path of
-the socket is @code{@CHRONYSOCKDIR@/chronyd.sock}.
-
-By default, @code{chronyd} binds to the loopback interface (with addresses
-@code{127.0.0.1} and @code{::1}). This blocks all access except from
-localhost. To listen for command packets on all interfaces, you can add the
-lines
-
-@example
-bindcmdaddress 0.0.0.0
-bindcmdaddress ::
-@end example
-
-to the configuration file.
-
-For each of IPv4 and IPv6 protocols, only one @code{bindcmdaddress}
-directive can be specified.
-
-An example that sets the path of the Unix domain command socket is
-@example
-bindcmdaddress /var/run/chrony/chronyd.sock
-@end example
-@c }}}
-@c {{{ broadcast directive
-@node broadcast directive
-@subsection broadcast
-The @code{broadcast} directive is used to declare a broadcast address to which
-chronyd should send packets in NTP broadcast mode (i.e. make chronyd act as a
-broadcast server). Broadcast clients on that subnet will be able to
-synchronise.
-
-The syntax is as follows
-
-@example
-broadcast 30 192.168.1.255
-broadcast 60 192.168.2.255 12123
-broadcast 60 ff02::101
-@end example
-
-In the first example, the destination port defaults to 123/udp (the normal NTP
-port). In the second example, the destionation port is specified as 12123.
-The first parameter in each case (30 or 60 respectively) is the interval in
-seconds between broadcast packets being sent. The second parameter in each
-case is the broadcast address to send the packet to. This should correspond to
-the broadcast address of one of the network interfaces on the computer where
-chronyd is running.
-
-You can have more than 1 @code{broadcast} directive if you have more than 1
-network interface onto which you wish to send NTP broadcast packets.
-
-@code{chronyd} itself cannot currently act as a broadcast client; it must always be
-configured as a point-to-point client by defining specific NTP servers and
-peers. This broadcast server feature is intended for providing a time source
-to other NTP software (e.g. various MS Windows clients).
-
-If ntpd is used as the broadcast client, it will try to use a point-to-point
-client/server NTP access to measure the round-trip delay. Thus, the broadcast
-subnet should also be the subject of an @code{allow} directive (@pxref{allow
-directive}).
-@c }}}
-@c {{{ clientloglimit
-@node clientloglimit directive
-@subsection clientloglimit
-This directive specifies the maximum amount of memory that @code{chronyd} is
-allowed to allocate for logging of client accesses. The default limit is
-524288 bytes, which allows monitoring of several thousands of addresses at the
-same time.
-
-In older @code{chrony} versions if the limit was set to 0, the memory
-allocation was unlimited.
-
-An example of the use of this directive is
-
-@example
-clientloglimit 1048576
-@end example
-@c }}}
-@c {{{ cmdallow
-@node cmdallow directive
-@subsection cmdallow
-
-This is similar to the @code{allow} directive (@pxref{allow directive}), except
-that it allows monitoring access (rather than NTP client access) to a particular
-subnet or host. (By 'monitoring access' is meant that @code{chronyc} can be
-run on those hosts and retrieve monitoring data from @code{chronyd} on this
-computer.)
-
-The syntax is identical to the @code{allow} directive.
-
-There is also a @code{cmdallow all} directive with similar behaviour to the
-@code{allow all} directive (but applying to monitoring access in this case, of
-course).
-
-Note that @code{chronyd} has to be configured with the @code{bindcmdaddress}
-directive to not listen only on the loopback interface to actually allow remote
-access.
-@c }}}
-@c {{{ cmddeny
-@node cmddeny directive
-@subsection cmddeny
-
-This is similar to the @code{cmdallow} directive (@pxref{cmdallow directive}),
-except that it denies monitoring access to a particular subnet or host,
-rather than allowing it.
-
-The syntax is identical.
-
-There is also a @code{cmddeny all} directive with similar behaviour to the
-@code{cmdallow all} directive.
-@c }}}
-@c {{{ cmdport
-@node cmdport directive
-@subsection cmdport
-
-The @code{cmdport} directive allows the port that is used for run-time
-monitoring (via the @code{chronyc} program) to be altered
-from its default (323/udp). If set to 0, @code{chronyd} will not open the
-port, this is useful to disable the @code{chronyc} access from the internet.
-(It does not disable the Unix domain command socket.)
-
-An example shows the syntax
-
-@example
-cmdport 257
-@end example
-
-This would make @code{chronyd} use 257/udp as its command port.
-(@code{chronyc} would need to be run with the @code{-p 257} switch to
-inter-operate correctly).
-@c }}}
-@c {{{ cmdratelimit
-@node cmdratelimit directive
-@subsection cmdratelimit
-This directive enables response rate limiting for command packets. It's
-similar to the @code{ratelimit} directive (@pxref{ratelimit directive}), except
-responses to the localhost are never limited and the default interval is 1 (2
-seconds), default burst is 16, and default leak rate is 2.
-
-An example of use of the command is
-
-@example
-cmdratelimit interval 2
-@end example
-@c }}}
-@c {{{ combinelimit
-@node combinelimit directive
-@subsection combinelimit
-When @code{chronyd} has multiple sources available for synchronization, it has
-to select one source as the synchronization source. The measured offsets and
-frequencies of the system clock relative to the other sources, however, can be
-combined with the selected source to improve the accuracy of the system clock.
-
-The @code{combinelimit} directive limits which sources are included in the
-combining algorithm. Their synchronization distance has to be shorter than the
-distance of the selected source multiplied by the value of the limit. Also,
-their measured frequencies have to be close to the frequency of the selected
-source.
-
-By default, the limit is 3. Setting the limit to 0 effectively disables the
-source combining algorithm and only the selected source will be used to
-control the system clock.
-
-The syntax is
-
-@example
-combinelimit <limit>
-@end example
-@c }}}
-@c {{{ corrtimeratio
-@node corrtimeratio directive
-@subsection corrtimeratio
-When @code{chronyd} is slewing the system clock to correct an offset, the rate
-at which it is slewing adds to the frequency error of the clock. On Linux,
-FreeBSD, NetBSD and Solaris this rate can be controlled.
-
-The @code{corrtimeratio} directive sets the ratio between the
-duration in which the clock is slewed for an average correction
-according to the source history and the interval in which the
-corrections are done (usually the NTP polling interval). Corrections
-larger than the average take less time and smaller corrections take
-more time, the amount of the correction and the correction time are
-inversely proportional.
-
-Increasing @code{corrtimeratio} improves the overall frequency error
-of the system clock, but increases the overall time error as the
-corrections take longer.
-
-By default, the ratio is set to 3, the time accuracy of the clock is
-preferred over its frequency accuracy.
-
-The syntax is
-
-@example
-corrtimeratio 100
-@end example
-
-The maximum allowed slew rate can be set by the @code{maxslewrate}
-directive (@pxref{maxslewrate directive}. The current remaining
-correction is shown in the @code{tracking} report (@pxref{tracking
-command}) as the @code{System time} value.
-@c }}}
-@c {{{ deny
-@node deny directive
-@subsection deny
-
-This is similar to the @code{allow} directive (@pxref{allow directive}),
-except that it denies NTP client access to a particular subnet or host,
-rather than allowing it.
-
-The syntax is identical.
-
-There is also a @code{deny all} directive with similar behaviour to the
-@code{allow all} directive.
-@c }}}
-@c {{{ driftfile
-@node driftfile directive
-@subsection driftfile
-One of the main activities of the @code{chronyd} program is to work out
-the rate at which the system clock gains or loses time relative to real
-time.
-
-Whenever @code{chronyd} computes a new value of the gain/loss rate, it
-is desirable to record it somewhere. This allows @code{chronyd} to
-begin compensating the system clock at that rate whenever it is
-restarted, even before it has had a chance to obtain an equally good
-estimate of the rate during the new run. (This process may take many
-minutes, at least).
-
-The driftfile command allows a file to be specified into which
-@code{chronyd} can store the rate information. Two parameters are
-recorded in the file. The first is the rate at which the system clock
-gains or loses time, expressed in parts per million, with gains
-positive. Therefore, a value of 100.0 indicates that when the system
-clock has advanced by a second, it has gained 100 microseconds on
-reality (so the true time has only advanced by 999900 microseconds).
-The second is an estimate of the error bound around the first value in
-which the true rate actually lies.
-
-An example of the driftfile command is
-
-@example
-driftfile @CHRONYVARDIR@/drift
-@end example
-@c }}}
-@c {{{ dumpdir
-@node dumpdir directive
-@subsection dumpdir
-To compute the rate of gain or loss of time, @code{chronyd} has to store
-a measurement history for each of the time sources it uses.
-
-Certain systems (Linux, FreeBSD, NetBSD, Solaris) have operating system
-support for setting the rate of gain or loss to compensate for known errors.
-(On Mac OS X, @code{chronyd} must simulate such a capability by periodically
-slewing the system clock forwards or backwards by a suitable amount to
-compensate for the error built up since the previous slew).
-
-For such systems, it is possible to save the measurement history across
-restarts of @code{chronyd} (assuming no changes are made to the system
-clock behaviour whilst it is not running). If this capability is to be
-used (via the dumponexit command in the configuration file, or the dump
-command in chronyc), the dumpdir command should be used to define the
-directory where the measurement histories are saved.
-
-An example of the command is
-
-@example
-dumpdir @CHRONYVARDIR@
-@end example
-
-A source whose reference id (the IP address for IPv4 sources) is
-1.2.3.4 would have its measurement history saved in the file
-@file{/var/lib/chrony/1.2.3.4.dat}.
-@c }}}
-@c {{{ dumponexit
-@node dumponexit directive
-@subsection dumponexit
-If this command is present, it indicates that @code{chronyd} should save
-the measurement history for each of its time sources recorded whenever
-the program exits. (See the dumpdir command above).
-@c }}}
-@c {{{ fallbackdrift
-@node fallbackdrift directive
-@subsection fallbackdrift
-Fallback drifts are long-term averages of the system clock drift
-calculated over exponentially increasing intervals. They are used
-when the clock is no longer synchronised to avoid quickly drifting
-away from true time if there was a short-term deviation in the drift
-before the synchronisation was lost.
-
-The directive specifies the minimum and maximum interval since last
-clock update to switch between fallback drifts. They are defined as a
-power of 2 (in seconds). The syntax is as follows
-
-@example
-fallbackdrift 16 19
-@end example
-
-In this example, the minimum interval is 16 (18 hours) and maximum
-interval is 19 (6 days). The system clock frequency will be set to
-the first fallback 18 hours after last clock update, to the
-second after 36 hours, etc. This might be a good setting to cover
-daily and weekly temperature fluctuations.
-
-By default (or if the specified maximum or minimum is 0), no fallbacks
-are used and the clock frequency changes only with new measurements from
-NTP, reference clocks or manual input.
-@c }}}
-@c {{{ hwclockfile
-@node hwclockfile directive
-@subsection hwclockfile
-The @code{hwclockfile} directive sets the location of the adjtime file which is
-used by the @file{/sbin/hwclock} program on Linux. @code{chronyd} parses the
-file to find out if the RTC keeps local time or UTC. It overrides the
-@code{rtconutc} directive (@pxref{rtconutc directive}).
-
-The default value is @file{@DEFAULT_HWCLOCK_FILE@}.
-
-An example of the command is
-
-@example
-hwclockfile /etc/adjtime
-@end example
-@c }}}
-@c {{{ include
-@node include directive
-@subsection include
-The @code{include} directive includes a specified configuration file or
-multiple configuration files when a wildcard pattern is specified. This can be
-useful when maintaining configuration on multiple hosts to keep the differences
-in separate files.
-
-An example of the command is
-
-@example
-include @SYSCONFDIR@/chrony.d/*.conf
-@end example
-@c }}}
-@c {{{ initstepslew
-@node initstepslew directive
-@subsection initstepslew
-In normal operation, @code{chronyd} slews the time when it needs to
-adjust the system clock. For example, to correct a system clock which
-is 1 second slow, @code{chronyd} slightly increases the amount by which the
-system clock is advanced on each clock interrupt, until the error is
-removed. (Actually, this is done by calling the @code{adjtime()} or
-similar system function which does it for us.) Note that at no time
-does time run backwards with this method.
-
-On most Unix systems it is not desirable to step the system clock,
-because many programs rely on time advancing monotonically forwards.
-
-When the @code{chronyd} daemon is initially started, it is possible that the
-system clock is considerably in error. Attempting to correct such an
-error by slewing may not be sensible, since it may take several hours
-to correct the error by this means.
-
-The purpose of the @code{initstepslew} directive is to allow @code{chronyd} to
-make a rapid measurement of the system clock error at boot time, and to
-correct the system clock by stepping before normal operation begins.
-Since this would normally be performed only at an appropriate point in
-the system boot sequence, no other software should be adversely affected
-by the step.
-
-If the correction required is less than a specified threshold, a slew is
-used instead. This makes it easier to restart @code{chronyd} whilst the
-system is in normal operation.
-
-The @code{initstepslew} directive takes a threshold and a list of NTP
-servers as arguments. Each of the servers
-is rapidly polled several times, and a majority voting mechanism used to
-find the most likely range of system clock error that is present. A
-step (or slew) is applied to the system clock to correct this error.
-@code{chronyd} then enters its normal operating mode.
-
-An example of use of the command is
-
-@example
-initstepslew 30 foo.example.net bar.example.net
-@end example
-
-where 2 NTP servers are used to make the measurement. The @code{30}
-indicates that if the system's error is found to be 30 seconds or less,
-a slew will be used to correct it; if the error is above 30 seconds, a
-step will be used.
-
-The @code{initstepslew} directive can also be used in an isolated LAN
-environment, where the clocks are set manually. The most stable
-computer is chosen as the master, and the other computers are slaved to
-it. If each of the slaves is configured with the local option (see
-below), the master can be set up with an @code{initstepslew} directive
-which references some or all of the slaves. Then, if the master machine
-has to be rebooted, the slaves can be relied on to 'flywheel' the time
-for the master.
-
-The @code{initstepslew} directive is functionally similar to a
-combination of the @code{makestep} and @code{server} directives with
-the @code{iburst} option. The main difference is that the
-@code{initstepslew} servers are used only before normal operation
-begins and that the foreground @code{chronyd} process waits for
-@code{initstepslew} to finish before exiting. This is useful to
-prevent programs started in the boot sequence after @code{chronyd}
-from reading the clock before it's stepped.
-@c }}}
-@c {{{ keyfile
-@node keyfile directive
-@subsection keyfile
-This command is used to specify the location of the file containing
-ID/key pairs for authentication of NTP packets.
-
-The format of the command is shown in the example below
-
-@example
-keyfile @SYSCONFDIR@/chrony.keys
-@end example
-
-The argument is simply the name of the file containing the ID/key
-pairs. The format of the file is shown below
-
-@example
-10 tulip
-11 hyacinth
-20 MD5 ASCII:crocus
-25 SHA1 HEX:1dc764e0791b11fa67efc7ecbc4b0d73f68a070c
- ...
-@end example
-
-Each line consists of an ID, name of an authentication hash function (optional)
-and a password. The ID can be any unsigned integer in the range 1 through
-2**32-1. The default hash function is MD5. Depending on how @code{chronyd}
-was compiled, other supported functions may be SHA1, SHA256, SHA384, SHA512,
-RMD128, RMD160, RMD256, RMD320, TIGER and WHIRLPOOL. The password can be
-specified as a string of characters not containing white space with an optional
-@code{ASCII:} prefix, or as a hexadecimal number with the @code{HEX:} prefix.
-The maximum length of the line is 2047 characters.
-
-The password is used with the hash function to generate and verify a message
-authentication code (MAC) in NTP packets. It's recommended to use SHA1 or a
-stronger hash function with random passwords specified in the hexadecimal
-format that have at least 128 bits. @code{chronyd} will log a warning to
-syslog on start if a source is specified in the configuration file with a key
-that has password shorter than 80 bits.
-
-The @code{keygen} command of @code{chronyc} (@pxref{keygen command}) can be
-used to generate random keys for the key file. By default, it generates
-160-bit MD5 or SHA1 keys.
-@c }}}
-@c {{{ leapsecmode
-@node leapsecmode directive
-@subsection leapsecmode
-A leap second is an adjustment that is occasionally applied to UTC to keep it
-close to the mean solar time. When a leap second is inserted, the last day of
-June or December has an extra second 23:59:60.
-
-For computer clocks that is a problem. The Unix time is defined as number of
-seconds since 00:00:00 UTC on 1 January 1970 without leap seconds. The system
-clock cannot have time 23:59:60, every minute has 60 seconds and every day has
-86400 seconds by definition. The inserted leap second is skipped and the clock
-is suddenly ahead of UTC by one second. The @code{leapsecmode} directive
-selects how that error is corrected. There are four options:
-
-@table @code
-@item system
-When inserting a leap second, the kernel steps the system clock backwards by
-one second when the clock gets to 00:00:00 UTC. When deleting a leap second,
-it steps forward by one second when the clock gets to 23:59:59 UTC. This is
-the default mode when the system driver supports leap seconds (i.e. on
-Linux, FreeBSD, NetBSD and Solaris).
-@item step
-This is similar to the @code{system} mode, except the clock is stepped by
-@code{chronyd} instead of the kernel. It can be useful to avoid bugs in the
-kernel code that would be executed in the @code{system} mode. This is the
-default mode when the system driver doesn't support leap seconds.
-@item slew
-The clock is corrected by slewing started at 00:00:00 UTC when a leap second is
-inserted or 23:59:59 UTC when a leap second is deleted. This may be preferred
-over the @code{system} and @code{step} modes when applications running on the
-system are sensitive to jumps in the system time and it's acceptable that the
-clock will be off for a longer time. On Linux with the default
-@code{maxslewrate} value (@pxref{maxslewrate directive}) the correction takes
-12 seconds.
-@item ignore
-No correction is applied to the clock for the leap second. The clock will be
-corrected later in normal operation when new measurements are made and the
-estimated offset includes the one second error.
-@end table
-
-An example of the command is
-
-@example
-leapsecmode slew
-@end example
-
-When serving time to NTP clients that can't be configured to correct their
-clocks for a leap second by slewing or they would correct them at slightly
-different rates when it's necessary to keep them close together, the
-@code{slew} mode can be combined with the @code{smoothtime} directive
-(@pxref{smoothtime directive}) to enable a server leap smear.
-
-When smearing a leap second, the leap status is suppressed on the server and
-the served time is corrected slowly be slewing instead of stepping. The clients
-don't need any special configuration as they don't know there is any leap
-second and they follow the server time which eventually brings them back to
-UTC. Care must be taken to ensure they use for synchronization only NTP
-servers which smear the leap second in exactly the same way.
-
-This feature needs to be used carefully, because the server is intentionally
-not serving its best estimate of the true time.
-
-A recommended configuration to enable a server leap smear is:
-
-@example
-leapsecmode slew
-maxslewrate 1000
-smoothtime 400 0.001 leaponly
-@end example
-
-The first directive is necessary to disable the clock step which would reset
-the smoothing process. The second directive limits the slewing rate of the
-local clock to 1000 ppm, which improves the stability of the smoothing process
-when the local correction starts and ends. The third directive enables the
-server time smoothing process. It will start when the clock gets to 00:00:00
-UTC and it will take 17 hours 34 minutes to finish. The frequency offset will
-be changing by 0.001 ppm per second and will reach maximum of 31.623 ppm. The
-@code{leaponly} option makes the duration of the leap smear constant and allows
-the clients to safely synchronise with multiple identically configured leap
-smearing servers.
-@c }}}
-@c {{{ leapsectz
-@node leapsectz directive
-@subsection leapsectz
-This directive is used to set the name of the timezone in the system
-tz database which @code{chronyd} can use to find out when will the
-next leap second occur. It will periodically check if the times
-23:59:59 and 23:59:60 are valid on Jun 30 and Dec 31 in the timezone.
-A useful timezone is @code{right/UTC}.
-This is mainly useful with reference clocks which don't provide the
-leap second information. It is not necessary to restart
-@code{chronyd} if the tz database is updated with a new leap second at
-least 12 hours before the event.
-
-An example of the command is
-
-@example
-leapsectz right/UTC
-@end example
-
-The following shell command verifies that the timezone contains leap
-seconds and can be used with this directive
-
-@example
-$ TZ=right/UTC date -d 'Dec 31 2008 23:59:60'
-Wed Dec 31 23:59:60 UTC 2008
-@end example
-
-@c }}}
-@c {{{ local
-@node local directive
-@subsection local
-The local keyword is used to allow @code{chronyd} to appear synchronised
-to real time (from the viewpoint of clients polling it), even if it has
-no current synchronisation source.
-
-This option is normally used on computers in an isolated network,
-where several computers are required to synchronise to one other, this
-being the "master" which is kept vaguely in line with real time by
-manual input.
-
-An example of the command is
-
-@example
-local stratum 10
-@end example
-
-The value 10 may be substituted with other values in the range 1
-through 15. Stratum 1 indicates a computer that has a true real-time
-reference directly connected to it (e.g. GPS, atomic clock etc)
-&ndash; such computers are expected to be very close to real time.
-Stratum 2 computers are those which have a stratum 1 server; stratum 3
-computers have a stratum 2 server and so on.
-
-A large value of 10 indicates that the clock is so many hops away from
-a reference clock that its time is fairly unreliable. Put another
-way, if the computer ever has access to another computer which is
-ultimately synchronised to a reference clock, it will almost certainly
-be at a stratum less than 10. Therefore, the choice of a high value
-like 10 for the local command prevents the machine's own time from
-ever being confused with real time, were it ever to leak out to
-clients that have visibility of real servers.
-@c }}}
-@c {{{ lock_all
-@node lock_all directive
-@subsection lock_all
-
-The @code{lock_all} directive will lock chronyd into RAM so that it
-will never be paged out. This mode is only supported on Linux. This
-directive uses the Linux mlockall() system call to prevent @code{chronyd}
-from ever being swapped out. This should result in lower and more
-consistent latency. It should not have significant impact on
-performance as @code{chronyd's} memory usage is modest. The mlockall man
-page has more details.
-@c }}}
-@c {{{ log
-@node log directive
-@subsection log
-@c {{{ section top
-The log command indicates that certain information is to be logged.
-
-@table @code
-@item measurements
-This option logs the raw NTP measurements and related information to a
-file called measurements.log.
-
-@item statistics
-This option logs information about the regression processing to a file
-called statistics.log.
-
-@item tracking
-This option logs changes to the estimate of the system's gain or loss
-rate, and any slews made, to a file called tracking.log.
-
-@item rtc
-This option logs information about the system's real-time clock.
-
-@item refclocks
-This option logs the raw and filtered reference clock measurements to
-a file called refclocks.log.
-@item tempcomp
-This option logs the temperature measurements and system rate
-compensations to a file called tempcomp.log.
-@end table
-
-The files are written to the directory specified by the logdir
-command.
-
-An example of the command is
-
-@example
-log measurements statistics tracking
-@end example
-
-@menu
-* measurements log:: The format of the measurements log
-* statistics log:: The format of the statistics log
-* tracking log:: The format of the tracking log
-* RTC log:: The format of the RTC log
-* refclocks log:: The format of the refclocks log
-* tempcomp log:: The format of the tempcomp log
-@end menu
-@c }}}
-@c {{{ measurements.log
-@node measurements log
-@subsubsection Measurements log file format
-
-An example line (which actually appears as a single line in the file)
-from the measurements log file is shown below.
-
-@example
-2014-10-13 05:40:50 158.152.1.76 N 2 111 111 1111 10 10 1.0 \
- -4.966e-03 2.296e-01 1.577e-05 1.615e-01 7.446e-03
-@end example
-
-The columns are as follows (the quantities in square brackets are the
-values from the example line above) :
-
-@enumerate 1
-@item
-Date [2014-10-13]
-@item
-Hour:Minute:Second [05:40:50]. Note that the date/time pair is
-expressed in UTC, not the local time zone.
-@item
-IP address of server/peer from which measurement comes [158.152.1.76]
-@item
-Leap status (@code{N} means normal, @code{+} means that the last minute
-of the current month has 61 seconds, @code{-} means that the last minute
-of the month has 59 seconds, @code{?} means the remote computer is not
-currently synchronised.) [N]
-@item
-Stratum of remote computer. [2]
-@item
-RFC 5905 tests 1 through 3 (1=pass, 0=fail) [111]
-@item
-RFC 5905 tests 5 through 7 (1=pass, 0=fail) [111]
-@item
-Tests for maximum delay, maximum delay ratio and maximum delay dev ratio,
-against defined parameters, and a test for synchronisation loop
-(1=pass, 0=fail) [1111]
-@item
-Local poll [10]
-@item
-Remote poll [10]
-@item
-`Score' (an internal score within each polling level used to decide when
-to increase or decrease the polling level. This is adjusted based on number
-of measurements currently being used for the regression algorithm). [1.0]
-@item
-The estimated local clock error (`theta' in RFC 5905). Positive
-indicates that the local clock is slow of the remote source. [-4.966e-03].
-@item
-The peer delay (`delta' in RFC 5905). [2.296e-01]
-@item
-The peer dispersion (`epsilon' in RFC 5905). [1.577e-05]
-@item
-The root delay (`DELTA' in RFC 5905). [1.615e-01]
-@item
-The root dispersion (`EPSILON' in RFC 5905). [7.446e-03]
-@end enumerate
-
-A banner is periodically written to the log file to indicate the
-meanings of the columns.
-@c }}}
-@c {{{ statistics.log
-@node statistics log
-@subsubsection Statistics log file format
-
-An example line (which actually appears as a single line in the file)
-from the statistics log file is shown below.
-
-@example
-1998-07-22 05:40:50 158.152.1.76 6.261e-03 -3.247e-03 \
- 2.220e-03 1.874e-06 1.080e-06 7.8e-02 16 0 8
-@end example
-
-The columns are as follows (the quantities in square brackets are the
-values from the example line above) :
-
-@enumerate 1
-@item
-Date [1998-07-22]
-@item
-Hour:Minute:Second [05:40:50]. Note that the date/time pair is
-expressed in UTC, not the local time zone.
-@item
-IP address of server/peer from which measurement comes [158.152.1.76]
-@item
-The estimated standard deviation of the measurements from the source (in
-seconds). [6.261e-03]
-@item
-The estimated offset of the source (in seconds, positive means the local
-clock is estimated to be fast, in this case). [-3.247e-03]
-@item
-The estimated standard deviation of the offset estimate (in
-seconds). [2.220e-03]
-@item
-The estimated rate at which the local clock is gaining or losing time
-relative to the source (in seconds per second, positive means the local
-clock is gaining). This is relative to the compensation currently being
-applied to the local clock, @emph{not} to the local clock without any
-compensation. [1.874e-06]
-@item
-The estimated error in the rate value (in seconds per
-second). [1.080e-06].
-@item
-The ration of |old_rate - new_rate| / old_rate_error. Large values
-indicate the statistics are not modelling the source very well. [7.8e-02]
-@item
-The number of measurements currently being used for the regression
-algorithm. [16]
-@item
-The new starting index (the oldest sample has index 0; this is the
-method used to prune old samples when it no longer looks like the
-measurements fit a linear model). [0, i.e. no samples discarded this
-time]
-@item
-The number of runs. The number of runs of regression residuals with the
-same sign is computed. If this is too small it indicates that the
-measurements are no longer represented well by a linear model and that
-some older samples need to be discarded. The number of runs for the
-data that is being retained is tabulated. Values of approximately half
-the number of samples are expected. [8]
-@end enumerate
-
-A banner is periodically written to the log file to indicate the
-meanings of the columns.
-@c }}}
-@c {{{ tracking.log
-@node tracking log
-@subsubsection Tracking log file format
-
-An example line (which actually appears as a single line in the file)
-from the tracking log file is shown below.
-
-@example
-2012-02-23 05:40:50 158.152.1.76 3 340.529 1.606 1.046e-03 N \
- 4 6.849e-03 -4.670e-04
-@end example
-
-The columns are as follows (the quantities in square brackets are the
-values from the example line above) :
-
-@enumerate 1
-@item
-Date [2012-02-03]
-@item
-Hour:Minute:Second [05:40:50]. Note that the date/time pair is
-expressed in UTC, not the local time zone.
-@item
-The IP address of the server/peer to which the local system is
-synchronised. [158.152.1.76]
-@item
-The stratum of the local system. [3]
-@item
-The local system frequency (in ppm, positive means the local system runs
-fast of UTC). [340.529]
-@item
-The error bounds on the frequency (in ppm) [1.606]
-@item
-The estimated local offset at the epoch (which is rapidly corrected by
-slewing the local clock. (In seconds, positive indicates the local
-system is fast of UTC). [1.046e-3]
-@item
-Leap status (@code{N} means normal, @code{+} means that the last minute
-of this month has 61 seconds, @code{-} means that the last minute of the month
-has 59 seconds, @code{?} means the clock is not currently synchronised.) [N]
-@item
-The number of combined sources. [4]
-@item
-The estimated standard deviation of the combined offset (in seconds).
-[6.849e-03]
-@item
-The remaining offset correction from the previous update (in seconds, positive
-means the system clock is slow of UTC). [-4.670e-04]
-@end enumerate
-
-A banner is periodically written to the log file to indicate the
-meanings of the columns.
-@c }}}
-@c {{{ rtc.log
-@node RTC log
-@subsubsection Real-time clock log file format
-
-An example line (which actually appears as a single line in the file)
-from the measurements log file is shown below.
-
-@example
-1998-07-22 05:40:50 -0.037360 1 -0.037434\
- -37.948 12 5 120
-@end example
-
-The columns are as follows (the quantities in square brackets are the
-values from the example line above) :
-
-@enumerate 1
-@item
-Date [1998-07-22]
-@item
-Hour:Minute:Second [05:40:50]. Note that the date/time pair is
-expressed in UTC, not the local time zone.
-@item
-The measured offset between the system's real time clock and the system
-(@code{gettimeofday()}) time. In seconds, positive indicates that the
-RTC is fast of the system time. [-0.037360].
-@item
-Flag indicating whether the regression has produced valid
-coefficients. (1 for yes, 0 for no). [1]
-@item
-Offset at the current time predicted by the regression process. A large
-difference between this value and the measured offset tends to indicate
-that the measurement is an outlier with a serious measurement
-error. [-0.037434].
-@item
-The rate at which the RTC is losing or gaining time relative to the
-system clock. In ppm, with positive indicating that the RTC is gaining
-time. [-37.948]
-@item
-The number of measurements used in the regression. [12]
-@item
-The number of runs of regression residuals of the same sign. Low values
-indicate that a straight line is no longer a good model of the measured
-data and that older measurements should be discarded. [5]
-@item
-The measurement interval used prior to the measurement being made (in
-seconds). [120]
-@end enumerate
-
-A banner is periodically written to the log file to indicate the
-meanings of the columns.
-@c }}}
-@c {{{ refclocks.log
-@node refclocks log
-@subsubsection Refclocks log file format
-
-An example line (which actually appears as a single line in the file)
-from the refclocks log file is shown below.
-
-@example
-2009-11-30 14:33:27.000000 PPS2 7 N 1 4.900000e-07 -6.741777e-07 1.000e-06
-@end example
-
-The columns are as follows (the quantities in square brackets are the
-values from the example line above) :
-
-@enumerate 1
-@item
-Date [2009-11-30]
-@item
-Hour:Minute:Second.Microsecond [14:33:27.000000]. Note that the
-date/time pair is expressed in UTC, not the local time zone.
-@item
-Reference ID of refclock from which measurement comes. [PPS2]
-@item
-Sequence number of driver poll within one polling interval for raw
-samples, or @code{-} for filtered samples. [7]
-@item
-Leap status (@code{N} means normal, @code{+} means that the last minute
-of the current month has 61 seconds, @code{-} means that the last minute
-of the month has 59 seconds). [N]
-@item
-Flag indicating whether the sample comes from PPS source. (1 for yes,
-0 for no, or @code{-} for filtered sample). [1]
-@item
-Local clock error measured by refclock driver, or @code{-} for
-filtered sample. [4.900000e-07]
-@item
-Local clock error with applied corrections. Positive indicates
-that the local clock is slow. [-6.741777e-07]
-@item
-Assumed dispersion of the sample. [1.000e-06]
-@end enumerate
-
-A banner is periodically written to the log file to indicate the
-meanings of the columns.
-@c }}}
-@c {{{ tempcomp.log
-@node tempcomp log
-@subsubsection Tempcomp log file format
-
-An example line (which actually appears as a single line in the file)
-from the tempcomp log file is shown below.
-
-@example
-2010-04-19 10:39:48 2.8000e+04 3.6600e-01
-@end example
-
-The columns are as follows (the quantities in square brackets are the
-values from the example line above) :
-
-@enumerate 1
-@item
-Date [2010-04-19]
-@item
-Hour:Minute:Second [10:39:48]. Note that the
-date/time pair is expressed in UTC, not the local time zone.
-@item
-Temperature read from tempcomp file. [2.8000e+04]
-@item
-Applied compensation in ppm, positive means the system clock is
-running faster than it would be without the compensation. [3.6600e-01]
-@end enumerate
-
-A banner is periodically written to the log file to indicate the
-meanings of the columns.
-@c }}}
-@c }}}
-@c {{{ logbanner
-@node logbanner directive
-@subsection logbanner
-A banner is periodically written to the log files enabled by the
-@code{log} directive to indicate the meanings of the columns.
-
-The @code{logbanner} directive specifies after how many entries in the
-log file should be the banner written. The default is 32, and 0 can be
-used to disable it entirely.
-@c }}}
-@c {{{ logchange
-@node logchange directive
-@subsection logchange
-This directive sets the threshold for the adjustment of the system clock
-that will generate a syslog message.
-
-By default, the threshold is 1 second.
-
-An example of use is
-
-@example
-logchange 0.1
-@end example
-
-which would cause a syslog message to be generated a system clock error
-of over 0.1 seconds starts to be compensated.
-
-Clock errors detected via NTP packets, reference clocks, or timestamps entered
-via the @code{settime} command of @code{chronyc} are logged.
-@c }}}
-@c {{{ logdir
-@node logdir directive
-@subsection logdir
-This directive allows the directory where log files are written to be
-specified.
-
-An example of the use of this directive is
-
-@example
-logdir /var/log/chrony
-@end example
-@c }}}
-@c {{{ mailonchange
-@node mailonchange directive
-@subsection mailonchange
-This directive defines an email address to which mail should be sent if
-chronyd applies a correction exceeding a particular threshold to the
-system clock.
-
-An example of use of this directive is
-
-@example
-mailonchange root@@localhost 0.5
-@end example
-
-This would send a mail message to root if a change of more than 0.5
-seconds were applied to the system clock.
-
-This directive can't be used when a system call filter is enabled by the
-@code{-F} option as the @code{chronyd} process will not be allowed to fork
-and execute the sendmail binary.
-@c }}}
-@c {{{ makestep
-@node makestep directive
-@subsection makestep
-Normally chronyd will cause the system to gradually correct any time
-offset, by slowing down or speeding up the clock as required. In
-certain situations, the system clock may be so far adrift that this
-slewing process would take a very long time to correct the system clock.
-
-This directive forces @code{chronyd} to step system clock if the
-adjustment is larger than a threshold value, but only if there were no
-more clock updates since @code{chronyd} was started than a specified
-limit (a negative value can be used to disable the limit).
-
-This is particularly useful when using reference clocks, because the
-@code{initstepslew} directive (@pxref{initstepslew directive}) works
-only with NTP sources.
-
-An example of the use of this directive is
-
-@example
-makestep 0.1 10
-@end example
-
-This would step system clock if the adjustment is larger than 0.1
-seconds, but only in the first ten clock updates.
-@c }}}
-@c {{{ manual
-@node manual directive
-@subsection manual
-The @code{manual} directive enables support at run-time for the
-@code{settime} command in chronyc (@pxref{settime command}). If no
-@code{manual} directive is included, any attempt to use the
-@code{settime} command in chronyc will be met with an error message.
-
-Note that the @code{settime} command can be enabled at run-time using
-the @code{manual} command in chronyc (@pxref{manual command}). (The
-idea of the two commands is that the @code{manual} command controls the
-manual clock driver's behaviour, whereas the @code{settime} command
-allows samples of manually entered time to be provided).
-@c }}}
-@c {{{ maxchange
-@node maxchange directive
-@subsection maxchange
-This directive sets the maximum allowed offset corrected on a clock
-update. The check is performed only after the specified number of
-updates to allow a large initial adjustment of the system clock. When
-an offset larger than the specified maximum occurs, it will be ignored
-for the specified number of times and then @code{chronyd} will give up
-and exit (a negative value can be used to never exit). In both cases
-a message is sent to syslog.
-
-An example of the use of this directive is
-
-@example
-maxchange 1000 1 2
-@end example
-
-After the first clock update, @code{chronyd} will check the offset on
-every clock update, it will ignore two adjustments larger than 1000
-seconds and exit on another one.
-@c }}}
-@c {{{ maxclockerror
-@node maxclockerror directive
-@subsection maxclockerror
-The @code{maxclockerror} directive sets the maximum assumed frequency
-error of the local clock. This is a frequency stability of the clock,
-not an absolute frequency error.
-
-By default, the maximum assumed error is set to 1 ppm.
-
-The syntax is
-
-@example
-maxclockerror <error-in-ppm>
-@end example
-
-Typical values for <error-in-ppm> might be 10 for a low quality clock
-to 0.1 for a high quality clock using a temperature compensated
-crystal oscillator.
-@c }}}
-@c {{{ maxdistance
-@node maxdistance directive
-@subsection maxdistance
-The @code{maxdistance} directive sets the maximum allowed root distance of the
-sources to not be rejected by the source selection algorithm. The distance
-includes the accumulated dispersion, which may be large when the source is no
-longer synchronised, and half of the total round-trip delay to the primary
-source.
-
-By default, the maximum root distance is 3 seconds.
-
-Setting @code{maxdistance} to a larger value can be useful to allow
-synchronisation with a server that only has a very infrequent connection to its
-sources and can accumulate a large dispersion between updates of its clock.
-
-The syntax is
-
-@example
-maxdistance <seconds>
-@end example
-@c }}}
-@c {{{ maxsamples
-@node maxsamples directive
-@subsection maxsamples
-The @code{maxsamples} directive sets the default maximum number of samples
-@code{chronyd} should keep for each source. This setting can be overriden for
-individual sources in the @code{server} and @code{refclock} directives
-(@pxref{server directive}, @pxref{refclock directive}). The default value is
-0, which disables the configurable limit. The useful range is 4 to 64.
-
-The syntax is
-
-@example
-maxsamples <samples>
-@end example
-@c }}}
-@c {{{ maxslewrate
-@node maxslewrate directive
-@subsection maxslewrate
-The @code{maxslewrate} directive sets the maximum rate at which @code{chronyd}
-is allowed to slew the time. It limits the slew rate controlled by the
-correction time ratio (@pxref{corrtimeratio directive}) and is effective
-only on systems where @code{chronyd} is able to control the rate (i.e.
-Linux, FreeBSD, NetBSD, Solaris).
-
-For each system there is a maximum frequency offset of the clock that
-can be set by the driver. On Linux it's 100000 ppm, on FreeBSD and NetBSD
-it's 5000 ppm and on Solaris it is 32500 ppm. Also, due to a kernel
-limitation, setting @code{maxslewrate} on FreeBSD and NetBSD to a value between
-500 ppm and 5000 ppm will effectively set it to 500 ppm.
-
-By default, the maximum slew rate is set to 83333.333 ppm (one twelfth).
-
-The syntax is
-
-@example
-maxslewrate <rate-in-ppm>
-@end example
-@c }}}
-@c {{{ maxupdateskew
-@node maxupdateskew directive
-@subsection maxupdateskew
-One of @code{chronyd's} tasks is to work out how fast or slow the computer's
-clock runs relative to its reference sources. In addition, it computes
-an estimate of the error bounds around the estimated value.
-
-If the range of error is too large, it probably indicates that the
-measurements have not settled down yet, and that the estimated gain or
-loss rate is not very reliable.
-
-The @code{maxupdateskew} parameter allows the threshold for determining
-whether an estimate may be so unreliable that it should not be used.
-By default, the threshold is 1000 ppm.
-
-The syntax is
-
-@example
-maxupdateskew <skew-in-ppm>
-@end example
-
-Typical values for <skew-in-ppm> might be 100 for a dial-up connection
-to servers over a phone line, and 5 or 10 for a computer on a LAN.
-
-It should be noted that this is not the only means of protection against
-using unreliable estimates. At all times, @code{chronyd} keeps track of
-both the estimated gain or loss rate, and the error bound on the
-estimate. When a new estimate is generated following another
-measurement from one of the sources, a weighted combination algorithm is
-used to update the master estimate. So if @code{chronyd} has an existing
-highly-reliable master estimate and a new estimate is generated which
-has large error bounds, the existing master estimate will dominate in
-the new master estimate.
-@c }}}
-@c {{{ minsamples
-@node minsamples directive
-@subsection minsamples
-The @code{minsamples} directive sets the default minimum number of samples
-@code{chronyd} should keep for each source. This setting can be overriden for
-individual sources in the @code{server} and @code{refclock} directives
-(@pxref{server directive}, @pxref{refclock directive}). The default value is
-0. The useful range is 4 to 64.
-
-The syntax is
-
-@example
-minsamples <samples>
-@end example
-@c }}}
-@c {{{ minsources
-@node minsources directive
-@subsection minsources
-The @code{minsources} directive sets the minimum number of sources that need
-to be considered as selectable in the source selection algorithm before the
-local clock is updated. The default value is 1.
-
-Setting this option to a larger number can be used to improve the reliability.
-More sources will have to agree with each other and the clock will not be
-updated when only one source (which could be serving wrong time) is reachable.
-
-The syntax is
-
-@example
-minsources <sources>
-@end example
-@c }}}
-@c {{{ noclientlog
-@node noclientlog directive
-@subsection noclientlog
-This directive, which takes no arguments, specifies that client accesses
-are not to be logged. Normally they are logged, allowing statistics to
-be reported using the @code{clients} command in @code{chronyc}.
-@c }}}
-@c {{{ peer
-@node peer directive
-@subsection peer
-The syntax of this directive is identical to that for the @code{server}
-directive (@pxref{server directive}), except that it is used to specify
-an NTP peer rather than an NTP server.
-
-When a key is specified by the @code{key} option to enable authentication, both
-peers must be configured to use the same key and the same key number.
-
-Please note that NTP peers that are not configured with a key to enable
-authentication are vulnerable to a denial-of-service attack. An attacker
-knowing that NTP hosts A and B are peering with each other can send a packet
-with random timestamps to host A with source address of B which will set the
-NTP state variables on A to the values sent by the attacker. Host A will then
-send on its next poll to B a packet with originate timestamp that doesn't match
-the transmit timestamp of B and the packet will be dropped. If the attacker
-does this periodically for both hosts, they won't be able to synchronize to
-each other.
-
-This attack can be prevented by enabling authentication with the key option, or
-using the @code{server} directive on both sides to specify the other host as a
-server instead of peer, the only drawback is that it will double the network
-traffic between the two hosts.
-@c }}}
-@c {{{ pidfile
-@node pidfile directive
-@subsection pidfile
-chronyd always writes its process ID (pid) to a file, and checks this file on startup to see if another chronyd may already be running on the system. By default, the file used is @code{/var/run/chronyd.pid}. The @code{pidfile} directive allows the name to be changed, e.g.
-
-@example
-pidfile /var/tmp/chronyd.pid
-@end example
-@c }}}
-@c {{{ pool
-@node pool directive
-@subsection pool
-The syntax of this directive is similar to that for the @code{server}
-directive (@pxref{server directive}), except that it is used to specify a pool
-of NTP servers rather than a single NTP server. The pool name is expected to
-resolve to multiple addresses which may change over time.
-
-All options valid in the @code{server} directive can be used in this directive
-too. There is one option specific to @code{pool} directive: @code{maxsources}
-sets the maximum number of sources that can be used from the pool, the default
-value is 4.
-
-On start, when the pool name is resolved, @code{chronyd} will add up to 16
-sources, one for each resolved address. When the number of sources from which
-at least one valid reply was received reaches @code{maxsources}, the other
-sources will be removed. When a pool source is unreachable or marked as
-falseticker, @code{chronyd} will try to replace the source with a newly
-resolved address of the pool.
-
-An example of the pool directive is
-
-@example
-pool pool.ntp.org iburst maxsources 3
-@end example
-@c }}}
-@c {{{ port
-@node port directive
-@subsection port
-This option allows you to configure the port on which @code{chronyd}
-will listen for NTP requests. The port will be open only when an address is
-allowed by the @code{allow} directive or command, an NTP peer is configured, or
-the broadcast server mode is enabled.
-
-The compiled in default is udp/123, the standard NTP port. If set to 0,
-@code{chronyd} will never open the server port and will operate strictly in a
-client-only mode. The source port used in NTP client requests can be set by
-the @code{acquisitionport} directive.
-
-An example of the port command is
-
-@example
-port 11123
-@end example
-
-This would change the NTP port served by @code{chronyd} on the computer to
-udp/11123.
-@c }}}
-@c {{{ ratelimit
-@node ratelimit directive
-@subsection ratelimit
-This directive enables response rate limiting for NTP packets. Its purpose is
-to reduce network traffic with misconfigured or broken NTP clients that are
-polling the server too frequently. The limits are applied to individual IP
-addresses. If multiple clients share one IP address (e.g. multiple hosts
-behind NAT), the sum of their traffic will be limited. If a client that
-increases its polling rate when it doesn't receive a reply is detected, its
-rate limiting will be temporarily suspended to avoid increasing the overall
-amount of traffic. The maximum number of IP addresses which can be monitored
-at the same time depends on the memory limit set by the @code{clientloglimit}
-directive.
-
-The @code{ratelimit} directive supports a number of subfields (which
-may be defined in any order):
-
-@table @code
-@item interval
-This option sets the minimum interval between responses. It is defined as a
-power of 2 in seconds. The default value is 3 (8 seconds). The minimum value
-is -4 and the maximum value is 12.
-@item burst
-This option sets the maximum number of responses that can be send in a burst,
-temporarily exceeding the limit specified by the @code{interval} option. This
-is useful for clients that make rapid measurements on start (e.g.
-@code{chronyd} with the @code{iburst} option). The default value is 8. The
-minimum value is 1 and the maximum value is 255.
-@item leak
-This option sets the rate at which responses are randomly allowed even if the
-limits specified by the @code{interval} and @code{burst} options are exceeded.
-This is necessary to prevent an attacker who is sending requests with a spoofed
-source address from completely blocking responses to that address. The leak
-rate is defined as a power of 1/2 and it is 3 by default, i.e. on average at
-least every eighth request has a response. The minimum value is 1 and the
-maximum value is 4.
-@end table
-
-An example use of the command is
-
-@example
-ratelimit interval 4 burst 4
-@end example
-
-This would reduce the response rate for IP addresses that send packets on
-average more frequently than once per 16 seconds and/or send packets in bursts
-with more than 4 packets.
-@c }}}
-@c {{{ refclock
-@node refclock directive
-@subsection refclock
-Reference clocks allows very accurate synchronisation and @code{chronyd}
-can function as a stratum 1 server. They are specified by the
-@code{refclock} directive. It has two mandatory parameters, a refclock driver
-name and a driver specific parameter.
-
-There are currently four drivers included:
-
-@table @code
-@item PPS
-PPSAPI (pulse per second) driver. The parameter is the path to a PPS
-device. Assert events are used by default. Driver option @code{:clear}
-can be appended to the path if clear events should be used instead.
-
-As PPS refclock gets only sub-second time information, it needs another
-source (NTP or non-PPS refclock) or local directive (@pxref{local
-directive}) enabled to work. For example:
-
-@example
-refclock PPS /dev/pps0 lock NMEA
-refclock SHM 0 offset 0.5 delay 0.2 refid NMEA noselect
-@end example
-
-@item SHM
-NTP shared memory driver. This driver uses a shared memory segment to
-receive data from another daemon which communicates with an actual
-reference clock. The parameter is the number of a shared memory segment,
-usually 0, 1, 2 or 3. For example:
-
-@example
-refclock SHM 1 poll 3 refid GPS1
-@end example
-
-A driver option in form @code{:perm=NNN} can be appended to the
-segment number to create the segment with permissions other than the
-default @code{0600}.
-
-Some examples of applications that can be used as SHM sources are
-@uref{http://catb.org/gpsd/, @code{gpsd}}, @code{shmpps} and
-@uref{http://www.buzzard.me.uk/jonathan/radioclock.html, @code{radioclk}}.
-@item SOCK
-Unix domain socket driver. It is similar to the SHM driver, but uses a
-different format and uses a socket instead of shared memory. It does not
-require polling and it
-supports transmitting of PPS data. The parameter is a path to the socket which
-will be created by @code{chronyd} and used to receive the messages. The format
-of messages sent over the socket is described in the
-@code{refclock_sock.c} file.
-
-Recent versions of the @code{gpsd} daemon include support for the SOCK
-protocol. The path where the socket should be created is described in the
-@code{gpsd(8)} man page. For example:
-
-@example
-refclock SOCK /var/run/chrony.ttyS0.sock
-@end example
-
-@item PHC
-PTP hardware clock (PHC) driver. The parameter is the path to the device of
-the PTP clock, which can be synchronised by a PTP daemon (e.g. @code{ptp4l}
-from the @uref{http://linuxptp.sourceforge.net/, Linux PTP project}. The PTP
-clocks are typically kept in TAI instead of UTC. The @code{offset} option can
-be used to compensate for the current UTC/TAI offset. For example:
-
-@example
-refclock PHC /dev/ptp0 poll 3 dpoll -2 offset -35
-@end example
-
-@end table
-
-The @code{refclock} command also supports a number of subfields (which
-may be defined in any order):
-
-@table @code
-@item poll
-Timestamps produced by refclock drivers are not used immediately, but
-they are stored and processed by a median filter in the polling interval
-specified by this option. This is defined as a power of 2 and may be
-negative to specify a sub-second interval. The
-default is 4 (16 seconds). A shorter interval allows @code{chronyd}
-to react faster to changes in clock frequency, but it may decrease
-the accuracy if the source is too noisy.
-@item dpoll
-Some drivers don't listen for external events and try to produce
-samples in their own polling interval. This is defined as a power of
-2 and may be negative to specify a sub-second interval. The default
-is 0 (1 second).
-@item refid
-This option is used to specify a reference id of the refclock, as up
-to four ASCII characters. By default, first three characters from
-driver name and the number of the refclock are used as refid. Each
-refclock must have an unique refid.
-@item filter
-This option sets the length of the median filter which is used to
-reduce noise. With each poll about 40 percent of the stored samples is
-discarded and one final sample is calculated as average of the
-remaining samples. If the length is 4 or above, at least 4 samples
-have to be collected between polls. For lengths below 4, the filter
-has to be full. The default is 64.
-@item rate
-PPS signal frequency (in Hz). This option only controls how the
-received pulses are aligned. To actually receive more than one
-pulse per second, a negative @code{dpoll} has to be specified (-3 for
-5Hz signal). The default is 1.
-@item lock
-This option can be used to lock a PPS refclock to another refclock
-whose reference id is specified by this option. In this mode received
-pulses are aligned directly to unfiltered samples from the refclock.
-By default, pulses are aligned to local clock, but only when it is
-well synchronised.
-@item offset
-This option can be used to compensate a constant error. The specified
-offset (in seconds) is applied to all samples produced by the
-refclock. The default is 0.0.
-@item delay
-This option sets the NTP delay of the source (in seconds). Half of
-this value is included in the maximum assumed error which is used in the
-source selection algorithm. Increasing the delay is useful to avoid
-having no majority in the algorithm or to make it prefer other
-sources. The default is 1e-9 (1 nanosecond).
-@item precision
-Refclock precision (in seconds). The default is 1e-6 (1 microsecond)
-for SHM refclock, and 1e-9 (1 nanosecond) for SOCK, PPS and PHC refclocks.
-@item maxdispersion
-Maximum allowed dispersion for filtered samples (in seconds). Samples
-with larger estimated dispersion are ignored. By default, this limit
-is disabled.
-@item prefer
-Prefer this source over sources without prefer option.
-@item noselect
-Never select this source. This is useful for monitoring or with sources
-which are not very accurate, but are locked with a PPS refclock.
-@item trust
-Assume time from this source is always true. It can be rejected as a
-falseticker in the source selection only if another source with this option
-doesn't agree with it.
-@item require
-Require that at least one of the sources specified with this option is
-selectable (i.e. recently reachable and not a falseticker) before updating the
-clock. Together with the @code{trust} option this may be useful to allow a
-trusted, but not very precise, reference clock to be safely combined with
-unauthenticated NTP sources in order to improve the accuracy of the clock.
-They can be selected and used for synchronisation only if they agree with
-the trusted and required source.
-@item minsamples
-Set the minimum number of samples kept for this source. This overrides the
-@code{minsamples} directive (@pxref{minsamples directive}).
-@item maxsamples
-Set the maximum number of samples kept for this source. This overrides the
-@code{maxsamples} directive (@pxref{maxsamples directive}).
-@end table
-
-@c }}}
-@c {{{ reselectdist
-@node reselectdist directive
-@subsection reselectdist
-When @code{chronyd} selects synchronisation source from available sources, it
-will prefer the one with minimum synchronisation distance. However, to
-avoid frequent reselecting when there are sources with similar distance, a
-fixed distance is added to the distance for sources that are currently not
-selected. This can be set with the @code{reselectdist} option. By default, the
-distance is 100 microseconds.
-
-The syntax is
-
-@example
-reselectdist <dist-in-seconds>
-@end example
-@c }}}
-@c {{{ rtcautotrim
-@node rtcautotrim directive
-@subsection rtcautotrim
-The @code{rtcautotrim} directive is used to keep the real time clock (RTC)
-close to the system clock automatically. When the system clock is synchronized
-and the estimated error between the two clocks is larger than the specified
-threshold, @code{chronyd} will trim the RTC as if the @code{trimrtc}
-(@pxref{trimrtc command}) command was issued.
-
-This directive is effective only with the @code{rtcfile} directive.
-
-An example of the use of this directive is
-
-@example
-rtcautotrim 30
-@end example
-
-This would set the threshold error to 30 seconds.
-@c }}}
-@c {{{ rtcdevice
-@node rtcdevice directive
-@subsection rtcdevice
-The @code{rtcdevice} directive defines the name of the device file for
-accessing the real time clock. By default this is @code{/dev/rtc}, unless the
-directive is used to set a different value. This applies to Linux systems with
-devfs. An example of use is
-
-@example
-rtcdevice /dev/misc/rtc
-@end example
-@c }}}
-@c {{{ rtcfile
-@node rtcfile directive
-@subsection rtcfile
-The @code{rtcfile} directive defines the name of the file in which
-@code{chronyd} can save parameters associated with tracking the accuracy
-of the system's real-time clock (RTC).
-
-The syntax is illustrated in the following example
-
-@example
-rtcfile @CHRONYVARDIR@/rtc
-@end example
-
-@code{chronyd} saves information in this file when it exits and when the
-@code{writertc} command is issued in @code{chronyc}. The information
-saved is the RTC's error at some epoch, that epoch (in seconds since
-January 1 1970), and the rate at which the RTC gains or loses time.
-
-So far, the support for real-time clocks is limited - their code is even
-more system-specific than the rest of the software. You can only use
-the real time clock facilities (the @code{rtcfile} directive and the
-@code{-s} command line option to @code{chronyd}) if the following three
-conditions apply:
-
-@enumerate 1
-@item
-You are running Linux version 2.2.x or later.
-
-@item
-You have compiled the kernel with extended real-time clock support
-(i.e. the @file{/dev/rtc} device is capable of doing useful things).
-
-@item
-You don't have other applications that need to make use of
-@file{/dev/rtc} at all.
-
-@end enumerate
-@c }}}
-@c {{{ rtconutc
-@node rtconutc directive
-@subsection rtconutc
-
-@code{chronyd} assumes by default that the real time clock (RTC) keeps
-local time (including any daylight saving changes). This is convenient
-on PCs running Linux which are dual-booted with DOS or Windows.
-
-NOTE : IF YOU KEEP THE REAL TIME CLOCK ON LOCAL TIME AND YOUR COMPUTER
-IS OFF WHEN DAYLIGHT SAVING (SUMMER TIME) STARTS OR ENDS, THE COMPUTER'S
-SYSTEM TIME WILL BE ONE HOUR IN ERROR WHEN YOU NEXT BOOT AND START
-CHRONYD.
-
-An alternative is for the RTC to keep Universal Coordinated Time (UTC).
-This does not suffer from the 1 hour problem when daylight saving starts
-or ends.
-
-If the @code{rtconutc} directive appears, it means the RTC is required
-to keep UTC. The directive takes no arguments. It is equivalent to
-specifying the @code{-u} switch to the Linux @file{/sbin/hwclock} program.
-
-Note that this setting is overriden when the @code{hwclockfile} directive
-(@pxref{hwclockfile directive}) is used.
-@c }}}
-@c {{{ rtcsync
-@node rtcsync directive
-@subsection rtcsync
-
-The @code{rtcsync} directive enables a mode where the system time is
-periodically copied to the real time clock (RTC).
-
-On Linux the RTC copy is performed by the kernel every 11 minutes. This
-directive cannot be used when the normal RTC tracking is enabled,
-i.e. when the @code{rtcfile} directive is used.
-
-On Mac OS X, chronyd will perform the RTC copy every 60 minutes when the
-system clock is in a synchronised state.
-
-On other systems this directive does nothing.
-@c }}}
-@c {{{ sched_priority
-@node sched_priority directive
-@subsection sched_priority
-
-On Linux, the @code{sched_priority} directive will select the SCHED_FIFO
-real-time scheduler at the specified priority (which must be between 0 and
-100). On Mac OS X, this option must have either a value of 0 (the default) to
-disable the thread time constraint policy or 1 for the policy to be enabled.
-Other systems do not support this option.
-
-On Linux, this directive uses the sched_setscheduler() system call to instruct
-the kernel to use the SCHED_FIFO first-in, first-out real-time scheduling
-policy for @code{chronyd} with the specified priority.
-This means that whenever @code{chronyd} is ready to run it will run,
-interrupting whatever else is running unless it is a higher priority
-real-time process. This should not impact performance as @code{chronyd's}
-resource requirements are modest, but it should result in lower and
-more consistent latency since @code{chronyd} will not need to wait for the
-scheduler to get around to running it. You should not use this unless
-you really need it. The sched_setscheduler man page has more details.
-
-On Mac OS X, this directive uses the thread_policy_set() kernel call to specify
-real-time scheduling. As noted for Linux, you should not use this directive
-unless you really need it.
-@c }}}
-@c {{{ server
-@node server directive
-@subsection server
-The @code{server} directive allows NTP servers to be specified. The
-client/server relationship is strictly hierarchical : a client may
-synchronise its system time to that of the server, but the server's
-system time will never be influenced by that of a client.
-
-The @code{server} directive is immediately followed by either the name
-of the server, or its IP address. The server command also supports a
-number of subfields (which may be defined in any order):
-
-@table @code
-@item port
-This option allows the UDP port on which the server understands NTP
-requests to be specified. For normal servers this option should not be
-required (the default is 123, the standard NTP port).
-@item minpoll
-Although @code{chronyd} will trim the rate at which it samples the
-server during normal operation, the user may wish to constrain the
-minimum polling interval. This is always defined as a power of 2, so
-@code{minpoll 5} would mean that the polling interval cannot drop below 32
-seconds. The default is 6 (64 seconds).
-@item maxpoll
-In a similar way, the user may wish to constrain the maximum polling
-interval. Again this is specified as a power of 2, @code{maxpoll 9}
-indicates that the polling interval must stay at or below 512 seconds.
-The default is 10 (1024 seconds).
-@item maxdelay
-@code{chronyd} uses the network round-trip delay to the server to
-determine how accurate a particular measurement is likely to be. Long
-round-trip delays indicate that the request, or the response, or both
-were delayed. If only one of the messages was delayed the measurement
-error is likely to be substantial.
-
-For small variations in round trip delay, @code{chronyd} uses a
-weighting scheme when processing the measurements. However, beyond a
-certain level of delay the measurements are likely to be so corrupted as
-to be useless. (This is particularly so on dial-up or other slow links,
-where a long delay probably indicates a highly asymmetric delay caused
-by the response waiting behind a lot of packets related to a download of
-some sort).
-
-If the user knows that round trip delays above a certain level should
-cause the measurement to be ignored, this level can be defined with the
-maxdelay command. For example, @code{maxdelay 0.3} would indicate that
-measurements with a round-trip delay of 0.3 seconds or more should be
-ignored. The default value is 3 seconds.
-
-@item maxdelayratio
-This option is similar to the maxdelay option above. @code{chronyd}
-keeps a record of the minimum round-trip delay amongst the previous
-measurements that it has buffered. If a measurement has a round trip
-delay that is greater than the maxdelayratio times the minimum delay, it
-will be rejected.
-
-@item maxdelaydevratio
-If a measurement has ratio of the increase in round-trip delay from
-the minimum delay amongst the previous measurements to the standard
-deviation of the previous measurements that is greater than
-maxdelaydevratio, it will be rejected. The default is 10.0.
-
-@item presend
-If the timing measurements being made by @code{chronyd} are the only
-network data passing between two computers, you may find that some
-measurements are badly skewed due to either the client or the server
-having to do an ARP lookup on the other party prior to transmitting a
-packet. This is more of a problem with long sampling intervals, which
-may be similar in duration to the lifetime of entries in the ARP caches
-of the machines.
-
-In order to avoid this problem, the @code{presend} option may be used.
-It takes a single integer argument, which is the smallest polling
-interval for which an extra pair of NTP packets will be exchanged
-between the client and the server prior to the actual measurement.
-For example, with the following option included in a
-@code{server} directive :
-
-@example
-presend 9
-@end example
-
-when the polling interval is 512 seconds or more, an extra NTP client
-packet will be sent to the server a short time (currently 4 seconds)
-before making the actual measurement.
-
-@item key
-The NTP protocol supports the inclusion of checksums in the packets, to
-prevent computers having their system time upset by rogue packets being
-sent to them. The checksums are generated as a function of a password,
-using the cryptographic hash function set in the key file.
-
-The association between key numbers and passwords is contained in the
-keys file, defined by the keyfile command.
-
-If the key option is present, @code{chronyd} will attempt to use
-authenticated packets when communicating with this server. The key
-number used will be the single argument to the key option (an
-unsigned integer in the range 1 through 2**32-1). The server
-must have the same password for this key number configured, otherwise no
-relationship between the computers will be possible.
-
-@item offline
-If the server will not be reachable when @code{chronyd} is started, the
-offline option may be specified. @code{chronyd} will not try to poll
-the server until it is enabled to do so (by using the online option of
-@code{chronyc}).
-
-@item auto_offline
-If this option is set, the server will be assumed to have gone offline when 2
-requests have been sent to it without receiving a response. This option avoids
-the need to run the @code{offline} (@pxref{offline command}) command from
-chrony when disconnecting the dial-up link. (It will still be necessary to use
-chronyc's @code{online} (@pxref{online command}) command when the link has been
-established, to enable measurements to start.)
-
-@item iburst
-On start, make four measurements over a short duration (rather than
-the usual periodic measurements).
-
-@item minstratum
-When the synchronisation source is selected from available sources, sources
-with lower stratum are normally preferred. This option can be used to increase
-stratum of the source to the specified minimum, so @code{chronyd} will avoid
-selecting that source. This is useful with low stratum sources that are known
-to be unrealiable or inaccurate and which should be used only when other
-sources are unreachable.
-
-@item polltarget
-Target number of measurements to use for the regression algorithm which
-@code{chronyd} will try to maintain by adjusting polling interval between
-@code{minpoll} and @code{maxpoll}. A higher target makes @code{chronyd} prefer
-shorter polling intervals. The default is 6 and a useful range is 6 to 60.
-
-@item version
-This option sets the NTP version number used in packets sent to the server.
-This can be useful when the server runs an old NTP implementation that doesn't
-respond to newer versions. The default version number is 4.
-
-@item prefer
-Prefer this source over sources without prefer option.
-
-@item noselect
-Never select this source. This is particularly useful for monitoring.
-
-@item trust
-Assume time from this source is always true. It can be rejected as a
-falseticker in the source selection only if another source with this option
-doesn't agree with it.
-
-@item require
-Require that at least one of the sources specified with this option is
-selectable (i.e. recently reachable and not a falseticker) before updating the
-clock. Together with the @code{trust} option this may be useful to allow a
-trusted authenticated source to be safely combined with unauthenticated sources
-in order to improve the accuracy of the clock. They can be selected and used
-for synchronisation only if they agree with the trusted and required source.
-
-@item minsamples
-Set the minimum number of samples kept for this source. This overrides the
-@code{minsamples} directive (@pxref{minsamples directive}).
-
-@item maxsamples
-Set the maximum number of samples kept for this source. This overrides the
-@code{maxsamples} directive (@pxref{maxsamples directive}).
-
-@end table
-@c }}}
-@c {{{ smoothtime
-@node smoothtime directive
-@subsection smoothtime
-The @code{smoothtime} directive can be used to enable smoothing of the time
-that @code{chronyd} serves to its clients to make it easier for them to track
-it and keep their clocks close together even when large offset or frequency
-corrections are applied to the server's clock, for example after being offline
-for a longer time.
-
-BE WARNED - the server is intentionally not serving its best estimate of the
-true time. If a large offset has been accumulated, it may take a very long
-time to smooth it out. This directive should be used only when the clients are
-not configured to poll also another NTP server, because they could reject this
-server as a falseticker or fail to select a source completely.
-
-The smoothing process is implemented with a quadratic spline function with two
-or three pieces. It's independent from any slewing applied to the local system
-clock, but the accumulated offset and frequency will be reset when the clock is
-corrected by stepping, e.g. by the @code{makestep} directive or command. The
-process can be reset without stepping the clock by the @code{smoothtime reset}
-command (@pxref{smoothtime command}).
-
-The first two arguments of the directive are the maximum frequency offset of
-the smoothed time to the tracked NTP time (in ppm) and the maximum rate at
-which the frequency offset is allowed to change (in ppm per second).
-@code{leaponly} is an optional third argument which enables a mode where only
-leap seconds are smoothed out and normal offset/frequency changes are ignored.
-The @code{leaponly} option is useful in a combination with the
-@code{leapsecmode slew} option (@pxref{leapsecmode directive}) to allow clients
-use multiple time smoothing servers safely.
-
-The smoothing process is activated automatically when 1/10000 of the estimated
-skew of the local clock falls below the maximum rate of frequency change. It
-can be also activated manually by the @code{smoothtime activate} command,
-which is particularly useful when the clock is synchronized only with manual
-input and the skew is always larger than the threshold. The @code{smoothing}
-command (@pxref{smoothing command}) can be used to monitor the process.
-
-An example suitable for clients using @code{ntpd} and 1024 second polling
-interval could be
-
-@example
-smoothtime 400 0.001
-@end example
-
-An example suitable for clients using @code{chronyd} on Linux could be
-
-@example
-smoothtime 50000 0.01
-@end example
-@c }}}
-@c {{{ stratumweight
-@node stratumweight directive
-@subsection stratumweight
-
-The @code{stratumweight} directive sets how much distance should be added
-per stratum to the synchronisation distance when @code{chronyd} selects
-the synchronisation source from available sources.
-
-The syntax is
-
-@example
-stratumweight <dist-in-seconds>
-@end example
-
-By default, the weight is 0.001 seconds. This means that stratum of the
-sources in the selection process matters only when the differences between the
-distances are in milliseconds.
-
-@c }}}
-@c {{{ tempcomp
-@node tempcomp directive
-@subsection tempcomp
-Normally, changes in the rate of drift of the system clock are caused mainly by
-changes in the temperature of the crystal oscillator on the mainboard.
-
-If there are temperature measurements available from a sensor close to the
-oscillator, the @code{tempcomp} directive can be used to compensate for the
-changes in the temperature and improve the stability and accuracy of the clock.
-
-The result depends on many factors, including the resolution of the sensor,
-the amount of noise in the measurements, the polling interval of the time
-source, the compensation update interval, how well is the compensation
-specified, and how close is the sensor to the oscillator. When it's working
-well, the frequency reported in the @file{tracking.log} file is more stable and
-the maximum reached offset is smaller.
-
-There are two forms of the directive. The first one has six parameters: a
-path to the file containing the current temperature from the sensor (in
-text format), the compensation update interval (in seconds), and temperature
-coefficients T0, k0, k1, k2.
-
-The frequency compensation is calculated (in ppm) as
-
-@code{k0 + (T - T0) * k1 + (T - T0)^2 * k2}
-
-The result has to be between -10 ppm and 10 ppm, otherwise the measurement is
-considered invalid and will be ignored. The k0 coefficient can be used to get
-the results in that range.
-
-An example of use is
-
-@example
-tempcomp /sys/class/hwmon/hwmon0/temp2_input 30 26000 0.0 0.000183 0.0
-@end example
-
-The measured temperature will be read from the file in the Linux sysfs
-filesystem every 30 seconds. When the temperature is 26000 (26 degrees
-Celsius), the frequency correction will be zero. When it is 27000 (27 degrees
-Celsius), the clock will be set to run 0.183ppm faster, etc.
-
-The second form has three parameters, the path to the sensor file, the update
-interval and a path to a file containing a list of (temperature, compensation)
-points, from which the compensation is linearly interpolated or extrapolated.
-
-An example is
-
-@example
-tempcomp /sys/class/hwmon/hwmon0/temp2_input 30 /etc/chrony.tempcomp
-@end example
-
-where the @file{chrony.tempcomp} file could have
-
-@example
-20000 1.0
-21000 0.64
-22000 0.36
-23000 0.16
-24000 0.04
-25000 0.0
-26000 0.04
-27000 0.16
-28000 0.36
-29000 0.64
-30000 1.0
-@end example
-
-Valid measurements with corresponding compensations are logged to the
-@file{tempcomp.log} file if enabled by the @code{log tempcomp} directive.
-@c }}}
-@c {{{ user
-@node user directive
-@subsection user
-The @code{user} directive sets the name of the system user to which
-@code{chronyd} will switch after start in order to drop root privileges.
-
-On Linux, @code{chronyd} needs to be compiled with support for the
-@code{libcap} library. On Mac OS X, FreeBSD, NetBSD and Solaris @code{chronyd}
-forks into two processes. The child process retains root privileges, but can
-only perform a very limited range of privileged system calls on behalf of the
-parent.
-
-The default value is @code{@DEFAULT_USER@}. The configure script has a
-@code{--with-user} option, which sets the default value.
-@c }}}
-@c }}}
-@c {{{ S:Running chronyc
-@node Running chronyc
-@section Running chronyc
-@c {{{ Section top
-Chronyc is the program that can be used to reconfigure options within
-the @code{chronyd} program whilst it is running. Chronyc can also be
-used to generate status reports about the operation of @code{chronyd}.
-
-@menu
-* Chronyc basic use:: How to run chronyc
-* Chronyc command line options:: Chrony's command line options
-* Security with chronyc:: How chronyd restricts access
-* Chronyc command reference:: All the commands chronyc supports
-@end menu
-@c }}}
-@c {{{ SS:Chronyc basic use
-@node Chronyc basic use
-@subsection Basic use
-The program chronyc is run by entering
-
-@example
-chronyc
-@end example
-
-at the command line. The prompt @code{chronyc} is displayed whilst
-chronyc is expecting input from the user, when it is being run from a
-terminal. If chronyc's input or output are redirected from/to a file,
-the prompt is not shown.
-
-When you are finished entering commands, the commands @code{exit} or
-@code{quit} will terminate the program. (Entering @key{Control-D} will
-also terminate the program.)
-@c }}}
-@c {{{ SS:Command line options
-@node Chronyc command line options
-@subsection Command line options
-Chronyc supports the following command line options.
-
-@table @code
-@item -v
-Displays the version number of chronyc on the terminal, and exists.
-@item -h <host>
-This option allows the user to specify which host (or comma-separated list of
-addresses) running the @code{chronyd} program is to be contacted. This allows
-for remote monitoring, without having to ssh to the other host first.
-
-The default is to contact @code{chronyd} running on the same host as
-that where chronyc is being run.
-@item -p <port>
-This option allows the user to specify the UDP port number which the
-target @code{chronyd} is using for its command & monitoring connections.
-This defaults to the compiled-in default; there would rarely be a need
-to change this.
-@item -n
-This option disables resolving IP addresses to hostnames.
-@item -d
-This option enables printing of debugging messages (if compiled with debugging
-support).
-@item -4
-With this option hostnames will be resolved only to IPv4 addresses.
-@item -6
-With this option hostnames will be resolved only to IPv6 addresses.
-@item -m
-With this option multiple commands can be specified on the command line.
-Each argument will be interpreted as a whole command.
-@item -f <conf-file>
-This option is ignored and is provided only for compatibility.
-@item -a
-This option is ignored and is provided only for compatibility.
-@end table
-@c }}}
-@c {{{ SS:Security with chronyc
-@node Security with chronyc
-@subsection Security with chronyc
-Many of the commands available through chronyc have a fair amount of
-power to reconfigure the run-time behaviour of @code{chronyd}. Consequently,
-@code{chronyc} is quite dangerous for the integrity of the target
-system's clock performance. Having access to @code{chronyd} via @code{chronyc}
-is more or less equivalent to being able to modify @code{chronyd's}
-configuration file (typically @file{@SYSCONFDIR@/chrony.conf}) and to restart
-@code{chronyd}.
-
-@code{chronyc} also provides a number of monitoring (as opposed to
-commanding or configuration) commands, which will not affect the behaviour of
-@code{chronyd}. However, you may still want to restrict access to these
-commands.
-
-There are two ways how @code{chronyc} can access @code{chronyd}. One is the
-Internet Protocol (IPv4 or IPv6) and the other is a Unix domain socket, which
-is accessible only locally by the root or chrony user (by default
-@code{@CHRONYSOCKDIR@/chronyd.sock}).
-
-Only the following monitoring commands are allowed from the internet:
-
-@itemize @bullet
-@item @code{activity}
-@item @code{manual list}
-@item @code{rtcdata}
-@item @code{smoothing}
-@item @code{sources}
-@item @code{sourcestats}
-@item @code{tracking}
-@item @code{waitsync}.
-@end itemize
-
-The set of hosts from which @code{chronyd} will accept these commands can be
-restricted. By default, the commands will be accepted only from the localhost
-(127.0.0.1 or ::1).
-
-All other commands are allowed only through the Unix domain socket. When sent
-over the internet, @code{chronyd} will respond with a @code{Not authorised}
-error, even if it's from the localhost.
-
-In @code{chrony} versions before 2.2 the commands had to be authenticated with
-a password and they were allowed from the internet, but that is no longer
-supported.
-
-By default, @code{chronyc} tries to connect to the Unix domain socket first.
-If that fails (e.g. because @code{chronyc} is running under a non-root user),
-it will try to connect to 127.0.0.1 and then ::1.
-@c }}}
-@c {{{ SS:Chronyc command reference
-@node Chronyc command reference
-@subsection Command reference
-@c {{{ Top/menu
-This section describes each of the commands available within the chronyc
-program. Chronyc offers the user a simple command-line driven
-interface.
-
-@menu
-* accheck command:: Verifying NTP client access
-* activity command:: Check how many NTP servers/peers are online/offline
-* add peer command:: Add a new NTP peer
-* add server command:: Add a new NTP server
-* allow all command:: Allowing NTP client access
-* allow command:: Allowing NTP client access
-* burst command:: Initiating a rapid set of measurements
-* clients command:: Show clients that have accessed the server
-* cmdaccheck command:: Verifying monitoring client access
-* cmdallow all command:: Allowing monitoring client access
-* cmdallow command:: Allowing monitoring client access
-* cmddeny all command:: Denying monitoring client access
-* cmddeny command:: Denying monitoring client access
-* cyclelogs command:: Close and re-open open log files
-* delete command:: Remove an NTP server or peer
-* deny all command:: Denying NTP client access
-* deny command :: Denying NTP client access
-* dns command:: Configure how are hostnames and IP addresses resolved
-* dump command:: Dump measurement histories to files
-* exit command:: Exit from chronyc
-* help command:: Generate help summary
-* keygen command:: Generate key for key file
-* local command:: Let computer be a server when it is unsynchronised
-* makestep command:: Correct the system clock by stepping instead of slewing
-* manual command:: Enable/disable/configure options for settime
-* maxdelay command:: Set max measurement delay for a source
-* maxdelaydevratio command:: Set max measurement delay for a source as ratio to deviation
-* maxdelayratio command:: Set max measurement delay for a source as ratio
-* maxpoll command:: Set maximum polling interval for a source
-* maxupdateskew command:: Set safety threshold for clock gain/loss rate
-* minpoll command:: Set minimum polling interval for a source
-* minstratum command:: Set minimum stratum for a source
-* offline command:: Warn that connectivity to a source will be lost
-* online command:: Warn that connectivity to a source has been restored
-* polltarget command:: Set poll target for a source
-* quit command:: Exit from chronyc
-* refresh command:: Refresh IP addresses
-* reselect command:: Reselect synchronisation source
-* reselectdist command:: Set improvement in distance needed to reselect a source
-* retries command:: Set maximum number of retries
-* rtcdata command:: Display RTC parameters
-* serverstats command:: Display statistics of the server
-* settime command:: Provide a manual input of the current time
-* smoothing command:: Display current time smoothing state
-* smoothtime command:: Reset/activate server time smoothing
-* sources command:: Display information about the current set of sources
-* sourcestats command:: Display the rate & offset estimation performance of sources
-* timeout command:: Set initial response timeout
-* tracking command:: Display system clock performance
-* trimrtc command:: Correct the RTC time to the current system time
-* waitsync command:: Wait until synchronised
-* writertc command:: Write the RTC parameters to file
-@end menu
-@c }}}
-@c {{{ accheck
-@node accheck command
-@subsubsection accheck
-This command allows you to check whether client NTP access is allowed
-from a particular host.
-
-Examples of use, showing a named host and a numeric IP address, are as
-follows:
-
-@example
-accheck foo.example.net
-accheck 1.2.3.4
-accheck 2001:db8::1
-@end example
-
-This command can be used to examine the effect of a series of
-@code{allow}, @code{allow all}, @code{deny} and @code{deny all} commands
-specified either via chronyc, or in @code{chronyd's} configuration file.
-@c }}}
-@c {{{ activity command
-@node activity command
-@subsubsection activity
-This command reports the number of servers/peers that are online and offline.
-If the auto_offline option is used in specifying some of the servers/peers, the
-@code{activity} command may be useful for detecting when all of them have
-entered the offline state after the PPP link has been disconnected.
-
-The report shows the number of servers/peers in 5 states:
-@itemize
-@item @code{online} : the server/peer is currently online (i.e. assumed by
-chronyd to be reachable)
-@item @code{offline} : the server/peer is currently offline (i.e. assumed by
-chronyd to be unreachable, and no measurements from it will be attempted.)
-@item @code{burst_online} : a burst command has been initiated for the
-server/peer and is being performed; after the burst is complete, the
-server/peer will be returned to the online state.
-@item @code{burst_offline} : a burst command has been initiated for the
-server/peer and is being performed; after the burst is complete, the
-server/peer will be returned to the offline state.
-@item @code{unresolved} : the name of the server/peer wasn't resolved to an
-address yet; this server is not visible in the @code{sources} and
-@code{sourcestats} reports.
-@end itemize
-@c }}}
-@c {{{ add peer
-@node add peer command
-@subsubsection add peer
-The @code{add peer} command allows a new NTP peer to be added whilst
-@code{chronyd} is running.
-
-Following the words @code{add peer}, the syntax of the following
-parameters and options is similar to that for the @code{peer}
-directive in the configuration file (@pxref{peer directive}).
-The following peer options can be set in the command:
-@code{port}, @code{minpoll}, @code{maxpoll}, @code{presend},
-@code{maxdelayratio}, @code{maxdelay}, @code{key}
-
-An example of using this command is shown below.
-
-@example
-add peer foo.example.net minpoll 6 maxpoll 10 key 25
-@end example
-@c }}}
-@c {{{ add server
-@node add server command
-@subsubsection add server
-The @code{add server} command allows a new NTP server to be added whilst
-@code{chronyd} is running.
-
-Following the words @code{add server}, the syntax of the following
-parameters and options is similar to that for the @code{server}
-directive in the configuration file (@pxref{server directive}).
-The following server options can be set in the command:
-@code{port}, @code{minpoll}, @code{maxpoll}, @code{presend},
-@code{maxdelayratio}, @code{maxdelay}, @code{key}
-
-An example of using this command is shown below.
-
-@example
-add server foo.example.net minpoll 6 maxpoll 10 key 25
-@end example
-@c }}}
-@c {{{ allow all
-@node allow all command
-@subsubsection allow all
-The effect of the allow command is identical to the @code{allow all}
-directive in the configuration file (@pxref{allow directive}).
-@c }}}
-@c {{{ allow
-@node allow command
-@subsubsection allow
-The effect of the allow command is identical to the @code{allow} directive in
-the configuration file (@pxref{allow directive}).
-
-The syntax is illustrated in the following examples:
-
-@example
-allow foo.example.net
-allow 1.2
-allow 3.4.5
-allow 6.7.8/22
-allow 6.7.8.9/22
-allow 2001:db8:789a::/48
-allow 0/0
-allow ::/0
-allow
-@end example
-
-The effect of each of these examples is the same as that of the @code{allow}
-directive in the configuration file.
-@c }}}
-@c {{{ burst
-@node burst command
-@subsubsection burst
-The @code{burst} command tells @code{chronyd} to make a set of measurements to
-each of its NTP sources over a short duration (rather than the usual
-periodic measurements that it makes). After such a burst, @code{chronyd} will
-revert to the previous state for each source. This might be either
-online, if the source was being periodically measured in the normal way,
-or offline, if the source had been indicated as being offline.
-(Switching a source between the online and offline states is described
-in @ref{online command}, @ref{offline command}).
-
-The syntax of the burst command is as follows
-
-@example
-burst <n-good-measurements>/<max-measurements> [<mask>/<masked-address>]
-burst <n-good-measurements>/<max-measurements> [<masked-address>/<masked-bits>]
-burst <n-good-measurements>/<max-measurements> [<address>]
-@end example
-
-The mask and masked-address arguments are optional, in which case
-@code{chronyd} will initiate a burst for all of its currently defined sources.
-
-The arguments have the following meaning and format.
-
-@table @code
-@item n-good-measurements
-This defines the number of good measurements that @code{chronyd} will want to
-obtain from each source. A measurement is good if it passes certain
-tests, for example, the round trip time to the source must be
-acceptable. (This allows @code{chronyd} to reject measurements that are likely
-to be bogus.)
-
-@item max-measurements
-This defines the maximum number of measurements that @code{chronyd} will
-attempt to make, even if the required number of good measurements has
-not been obtained.
-
-@item mask
-This is an IP address with which the IP address of each of @code{chronyd}'s
-sources is to be masked.
-
-@item masked-address
-This is an IP address. If the masked IP address of a source matches this value
-then the burst command is applied to that source.
-
-@item masked-bits
-This can be used with @code{masked-address} for CIDR notation, which is a
-shorter alternative to the form with mask.
-
-@item address
-This is an IP address or a hostname. The burst command is applied only to that
-source.
-
-@end table
-
-If no mask or masked address arguments are provided, every source will
-be matched.
-
-An example of the two-argument form of the command is
-
-@example
-burst 2/10
-@end example
-
-This will cause @code{chronyd} to attempt to get two good measurements from
-each source, stopping after two have been obtained, but in no event will
-it try more than ten probes to the source.
-
-Examples of the four-argument form of the command are
-
-@example
-burst 2/10 255.255.0.0/1.2.0.0
-burst 2/10 2001:db8:789a::/48
-@end example
-
-In the first case, the two out of ten sampling will only be applied to
-sources whose IPv4 addresses are of the form @code{1.2.x.y}, where x and y
-are arbitrary. In the second case, the sampling will be applied to sources
-whose IPv6 addresses have first 48 bits equal to @code{2001:db8:789a}.
-
-Example of the three-argument form of the command is
-
-@example
-burst 2/10 foo.example.net
-@end example
-@c }}}
-@c {{{ clients
-@node clients command
-@comment node-name, next, previous, up
-@subsubsection clients
-This command shows a list of clients that have accessed the server,
-through either the NTP or command/monitoring ports. It doesn't include
-accesses over the Unix domain comamnd socket. There are no arguments.
-
-An example of the output is
-
-@example
-Hostname NTP Drop Int IntL Last Cmd Drop Int Last
-===============================================================================
-localhost 2 0 2 - 133 15 0 -1 7
-foo.example.net 12 0 6 - 23 0 0 - -
-@end example
-
-Each row shows the data for a single host. Only hosts that have passed
-the host access checks (set with the @code{allow}, @code{deny},
-@code{cmdallow} and @code{cmddeny} commands or configuration file
-directives) are logged. The intervals are displayed as a power of 2 in
-seconds.
-
-The columns are as follows:
-
-@enumerate 1
-@item
-The hostname of the client
-@item
-The number of NTP packets received from the client.
-@item
-The number of NTP packets dropped to limit the response rate.
-@item
-The average interval between NTP packets.
-@item
-The average interval between NTP packets after limiting the response rate.
-@item
-Time since the last NTP packet was received
-@item
-The number of command packets received from the client.
-@item
-The number of command packets dropped to limit the response rate.
-@item
-The average interval between command packets.
-@item
-Time since the last command packet was received.
-@end enumerate
-@c }}}
-@c {{{ cmdaccheck
-@node cmdaccheck command
-@subsubsection cmdaccheck
-This command is similar to the @code{accheck} command, except that it is
-used to check whether monitoring access is permitted from a named host.
-
-Examples of use are as follows:
-
-@example
-cmdaccheck foo.example.net
-cmdaccheck 1.2.3.4
-cmdaccheck 2001:db8::1
-@end example
-@c }}}
-@c {{{ cmdallow all
-@node cmdallow all command
-@subsubsection cmdallow all
-This is similar to the @code{allow all} command, except that it is used to
-allow particular hosts or subnets to use @code{chronyc} to monitor with
-@code{chronyd} on the current host.
-@c }}}
-@c {{{ cmdallow
-@node cmdallow command
-@subsubsection cmdallow
-This is similar to the @code{allow} command, except that it is used to allow
-particular hosts or subnets to use @code{chronyc} to monitor with
-@code{chronyd} on the current host.
-@c }}}
-@c {{{ cmddeny all
-@node cmddeny all command
-@subsubsection cmddeny all
-This is similar to the @code{deny all} command, except that it is used to allow
-particular hosts or subnets to use @code{chronyc} to monitor @code{chronyd} on
-the current host.
-@c }}}
-@c {{{ cmddeny
-@node cmddeny command
-@subsubsection cmddeny
-This is similar to the @code{deny} command, except that it is used to allow
-particular hosts or subnets to use @code{chronyc} to monitor @code{chronyd} on
-the current host.
-@c }}}
-@c {{{ cyclelogs
-@node cyclelogs command
-@subsubsection cyclelogs
-The @code{cyclelogs} command causes all of @code{chronyd's} open log files to
-be closed and re-opened. This allows them to be renamed so that they can be
-periodically purged. An example of how to do this is shown below.
-
-@example
-% mv /var/log/chrony/measurements.log /var/log/chrony/measurements1.log
-% chronyc cyclelogs
-% ls -l /var/log/chrony
--rw-r--r-- 1 root root 0 Jun 8 18:17 measurements.log
--rw-r--r-- 1 root root 12345 Jun 8 18:17 measurements1.log
-% rm -f measurements1.log
-@end example
-@c }}}
-@c {{{ delete
-@node delete command
-@subsubsection delete
-The @code{delete} command allows an NTP server or peer to be removed
-from the current set of sources.
-
-The syntax is illustrated in the examples below.
-
-@example
-delete foo.example.net
-delete 1.2.3.4
-delete 2001:db8::1
-@end example
-
-There is one parameter, the name or IP address of the server or peer to
-be deleted.
-@c }}}
-@c {{{ deny all
-@node deny all command
-@subsubsection deny all
-The effect of the allow command is identical to the @code{deny all}
-directive in the configuration file (@pxref{deny directive}).
-@c }}}
-@c {{{ deny
-@node deny command
-@subsubsection deny
-The effect of the allow command is identical to the @code{deny}
-directive in the configuration file (@pxref{deny directive}).
-
-The syntax is illustrated in the following examples:
-
-@example
-deny foo.example.net
-deny 1.2
-deny 3.4.5
-deny 6.7.8/22
-deny 6.7.8.9/22
-deny 2001:db8:789a::/48
-deny 0/0
-deny ::/0
-deny
-@end example
-@c }}}
-@c {{{ dns
-@node dns command
-@subsubsection dns
-The @code{dns} command configures how are hostnames and IP addresses resolved in
-@code{chronyc}. IP addresses can be resolved to hostnames when printing results
-of @code{sources}, @code{sourcestats}, @code{tracking} and @code{clients}
-commands. Hostnames are resolved in commands that take an address as argument.
-
-There are five forms of the command:
-
-@table @code
-@item dns -n
-Disables resolving IP addresses to hostnames. Raw IP addresses will be
-displayed.
-@item dns +n
-Enables resolving IP addresses to hostnames. This is the default unless
-@code{chronyc} was started with @code{-n} option.
-@item dns -4
-Resolves hostnames only to IPv4 addresses.
-@item dns -6
-Resolves hostnames only to IPv6 addresses.
-@item dns -46
-Resolves hostnames to both address families. This is the default unless
-@code{chronyc} was started with @code{-4} or @code{-6} option.
-@end table
-@c }}}
-@c {{{ dump
-@node dump command
-@subsubsection dump
-The @code{dump} command causes @code{chronyd} to write its current history of
-measurements for each of its sources to dump files, either for
-inspection or to support the @code{-r} option when @code{chronyd} is restarted.
-
-The @code{dump} command is somewhat equivalent to the @code{dumponexit}
-directive in the chrony configuration file. @xref{dumponexit directive}.
-
-To use the @code{dump}, you probably want to configure the name of the
-directory into which the dump files will be written. This can only be
-done in the configuration file, see @ref{dumpdir directive}.
-@c }}}
-@c {{{ exit
-@node exit command
-@subsubsection exit
-The exit command exits from chronyc and returns the user to the shell
-(same as the quit command).
-@c }}}
-@c {{{ help
-@node help command
-@subsubsection help
-The help command displays a summary of the commands and their arguments.
-@c }}}
-@c {{{ keygen
-@node keygen command
-@subsubsection keygen
-The @code{keygen} command generates a key that can be added to the
-key file (@pxref{keyfile directive}) to allow NTP authentication between
-server and client, or peers. The key is generated from the @code{/dev/urandom}
-device and it's printed to standard output.
-
-The command has three optional arguments. The first argument is the key number
-(by default 1), which will be specified with the @code{key} option of the
-@code{server} or @code{peer} directives in the configuration file. The second
-argument is the hash function (by default SHA1 or MD5 if SHA1 is not available)
-and the third argument is the number of bits the key should have, between 80
-and 4096 bits (by default 160 bits).
-
-An example is
-
-@example
-keygen 73 SHA1 256
-@end example
-
-which generates a 256-bit SHA-1 key with number 73. The printed line would
-then be securely transferred and added to key files on both server and client,
-or peers.
-@c }}}
-@c {{{ local
-@node local command
-@subsubsection local
-The @code{local} command allows @code{chronyd} to be told that it is to appear
-as a reference source, even if it is not itself properly synchronised to
-an external source. (This can be used on isolated networks, to allow
-one computer to be a master time server with the other computers slaving
-to it.) The @code{local} command is somewhat equivalent to the
-@code{local} directive in the configuration file, see @ref{local directive}.
-
-The syntax is as shown in the following examples.
-
-@example
-local stratum 10
-local off
-@end example
-
-The first example enables the local reference mode on the host, and sets
-the stratum at which it should claim to be synchronised.
-
-The second example disables the local reference mode.
-@c }}}
-@c {{{ makestep
-@node makestep command
-@subsubsection makestep
-Normally chronyd will cause the system to gradually correct any time
-offset, by slowing down or speeding up the clock as required. In
-certain situations, the system clock may be so far adrift that this
-slewing process would take a very long time to correct the system clock.
-
-The @code{makestep} command can be used in this situation. There are two forms
-of the command. The first form has no parameters. It tells @code{chronyd} to
-cancel any remaining correction that was being slewed and jump the system clock
-by the equivalent amount, making it correct immediately.
-
-The second form configures the automatic stepping, similarly to the
-@code{makestep} directive (@pxref{makestep directive}). It has two parameters,
-stepping threshold (in seconds) and number of future clock updates for which
-will be the threshold active. This can be used with the @code{burst} command
-to quickly make a new measurement and correct the clock by stepping if needed,
-without waiting for @code{chronyd} to complete the measurement and update the
-clock.
-
-@example
-makestep 0.1 1
-burst 1/2
-@end example
-
-BE WARNED - certain software will be seriously affected by such jumps to
-the system time. (That is the reason why chronyd uses slewing
-normally.)
-@c }}}
-@c {{{ manual
-@node manual command
-@subsubsection manual
-The manual command enables and disables use of the @code{settime}
-command (@pxref{settime command}), and is used to modify the behaviour
-of the manual clock driver.
-
-Examples of the command are shown below.
-
-@example
-manual on
-manual off
-manual delete 1
-manual list
-manual reset
-@end example
-
-The @code{on} form of the command enables use of the @code{settime}
-command.
-
-The @code{off} form of the command disables use of the @code{settime}
-command.
-
-The @code{list} form of the command lists all the samples currently
-stored in @code{chronyd}. The output is illustrated below.
-
-@example
-210 n_samples = 1
-# Date Time(UTC) Slewed Original Residual
-====================================================
- 0 27Jan99 22:09:20 0.00 0.97 0.00
-@end example
-
-The columns as as follows :
-
-@enumerate 1
-@item
-The sample index (used for the @code{manual delete} command)
-@item
-The date and time of the sample
-@item
-The system clock error when the timestamp was entered, adjusted to allow
-for changes made to the system clock since.
-@item
-The system clock error when the timestamp was entered, as it originally
-was (without allowing for changes to the system clock since).
-@item
-The regression residual at this point, in seconds. This allows
-'outliers' to be easily spotted, so that they can be deleted using the
-@code{manual delete} command.
-@end enumerate
-
-The @code{delete} form of the command deletes a single sample. The
-parameter is the index of the sample, as shown in the first column of
-the output from @code{manual list}. Following deletion of the data
-point, the current error and drift rate are re-estimated from the
-remaining data points and the system clock trimmed if necessary. This
-option is intended to allow 'outliers' to be discarded, i.e. samples
-where the administrator realises he/she has entered a very poor
-timestamp.
-
-The @code{reset} form of the command deletes all samples at once. The
-system clock is left running as it was before the command was entered.
-@c }}}
-@c {{{ maxdelay
-@node maxdelay command
-@subsubsection maxdelay
-This allows the @code{maxdelay} option for one of the sources to be
-modified, in the same way as specifying the @code{maxdelay} option for
-the @code{server} directive in the configuration file (@pxref{server
-directive}).
-
-The following examples illustrate the syntax
-
-@example
-maxdelay foo.example.net 0.3
-maxdelay 1.2.3.4 0.0015
-maxdelay 2001:db8::1 0.0015
-@end example
-
-The first example sets the maximum network delay allowed for a
-measurement to the host @code{foo.example.net} to 0.3 seconds. The second
-and third examples set the maximum network delay for a measurement to
-the host with IPv4 address @code{1.2.3.4} and the host with IPv6 address
-@code{2001:db8::1} to 1.5 milliseconds.
-
-(Any measurement whose network delay exceeds the specified value is
-discarded.)
-@c }}}
-@c {{{ maxdelaydevratio
-@node maxdelaydevratio command
-@subsubsection maxdelaydevratio
-This allows the @code{maxdelaydevratio} option for one of the sources to be
-modified, in the same way as specifying the @code{maxdelaydevratio} option
-for the @code{server} directive in the configuration file (@pxref{server
-directive}).
-
-The following examples illustrate the syntax
-
-@example
-maxdelaydevratio foo.example.net 0.1
-maxdelaydevratio 1.2.3.4 1.0
-maxdelaydevratio 2001:db8::1 100.0
-@end example
-@c }}}
-@c {{{ maxdelayratio
-@node maxdelayratio command
-@subsubsection maxdelayratio
-This allows the @code{maxdelayratio} option for one of the sources to be
-modified, in the same way as specifying the @code{maxdelayratio} option
-for the @code{server} directive in the configuration file (@pxref{server
-directive}).
-
-The following examples illustrate the syntax
-
-@example
-maxdelayratio foo.example.net 1.5
-maxdelayratio 1.2.3.4 2.0
-maxdelayratio 2001:db8::1 2.0
-@end example
-
-The first example sets the maximum network delay for a measurement to
-the host @code{foo.example.net} to be 1.5 times the minimum delay found
-amongst the previous measurements that have been retained. The second
-and third examples set the maximum network delay for a measurement to
-the host with IPv4 address @code{1.2.3.4} and the host with IPv6
-address @code{2001:db8::1} to be double the retained minimum.
-
-As for @code{maxdelay}, any measurement whose network delay is too large
-will be discarded.
-@c }}}
-@c {{{ maxpoll
-@node maxpoll command
-@subsubsection maxpoll
-The @code{maxpoll} command is used to modify the minimum polling
-interval for one of the current set of sources. It is equivalent to the
-@code{maxpoll} option in the @code{server} directive in the
-configuration file (@pxref{server directive}).
-
-The syntax is as follows
-
-@example
-maxpoll <host> <new-maxpoll>
-@end example
-
-where the host can be specified as either a machine name or
-IP address. The new minimum poll is specified as a base-2 logarithm of
-the number of seconds between polls (e.g. specify 6 for 64 second
-sampling).
-
-An example is
-
-@example
-maxpoll foo.example.net 10
-@end example
-
-which sets the maximum polling interval for the host @code{foo.example.net}
-to 1024 seconds.
-
-Note that the new maximum polling interval only takes effect after the
-next measurement has been made.
-@c }}}
-@c {{{ maxupdateskew
-@node maxupdateskew command
-@subsubsection maxupdateskew
-This command has the same effect as the @code{maxupdateskew} directive
-in the configuration file, see @ref{maxupdateskew directive}.
-@c }}}
-@c {{{ minpoll
-@node minpoll command
-@subsubsection minpoll
-The @code{minpoll} command is used to modify the minimum polling
-interval for one of the current set of sources. It is equivalent to the
-@code{minpoll} option in the @code{server} directive in the
-configuration file (@pxref{server directive}).
-
-The syntax is as follows
-
-@example
-minpoll <host> <new-minpoll>
-@end example
-
-where the host can be specified as either a machine name or
-IP address. The new minimum poll is specified as a base-2 logarithm of
-the number of seconds between polls (e.g. specify 6 for 64 second
-sampling).
-
-An example is
-
-@example
-minpoll foo.example.net 5
-@end example
-
-which sets the minimum polling interval for the host @code{foo.example.net}
-to 32 seconds.
-
-Note that the new minimum polling interval only takes effect after the
-next measurement has been made.
-@c }}}
-@c {{{ minstratum
-@node minstratum command
-@subsubsection minstratum
-The @code{minstratum} command is used to modify the minimum stratum
-for one of the current set of sources. It is equivalent to the
-@code{minstratum} option in the @code{server} directive in the
-configuration file (@pxref{server directive}).
-
-The syntax is as follows
-
-@example
-minstratum <host> <new-min-stratum>
-@end example
-
-where the host can be specified as either a machine name or
-IP address.
-
-An example is
-
-@example
-minpoll foo.example.net 5
-@end example
-
-which sets the minimum stratum for the host @code{foo.example.net}
-to 5.
-
-Note that the new minimum stratum only takes effect after the
-next measurement has been made.
-@c }}}
-@c {{{ offline
-@node offline command
-@subsubsection offline
-The @code{offline} command is used to warn @code{chronyd} that the network
-connection to a particular host or hosts is about to be lost. It can
-be used on computers with intermittent connection to their time
-sources, to warn @code{chronyd} that the connection is about to be broken.
-
-An example of how to use @code{offline} in this case is shown in
-@ref{Advising chronyd of internet availability}.
-
-Another case where @code{offline} could be used is where a computer
-serves time to a local group of computers, and has a permanant
-connection to true time servers outside the organisation. However, the
-external connection is heavily loaded at certain times of the day and
-the measurements obtained are less reliable at those times. In this
-case, it is probably most useful to determine the gain/loss rate during
-the quiet periods and let the whole network coast through the loaded
-periods. The @code{offline} and @code{online} commands can be used to
-achieve this. The situation is shown in the figure below.
-
-@example
-@group
- +----------+
- |Ext source|
- +----------+
- |
- |
- |/| <-- Link with variable
- | reliability
- |
- +-------------------+
- |Local master server|
- +-------------------+
- |
- +---+---+-----+-----+----+----+
- | | | | | | |
- Local clients
-@end group
-@end example
-
-
-There are four forms of the @code{offline} command. The first form is a
-wildcard, meaning all sources. The second form allows an IP address mask
-and a masked address to be specified. The third form uses the CIDR
-notation. The fourth form uses an IP address or a hostname. These forms are
-illustrated below.
-
-@example
-offline
-offline 255.255.255.0/1.2.3.0
-offline 2001:db8:789a::/48
-offline foo.example.net
-@end example
-
-The second form means that the @code{offline} command is to be applied
-to any source whose IPv4 address is in the @code{1.2.3} subnet. (The host's
-address is logically and-ed with the mask, and if the result matches the
-masked-address the host is processed). The third form means that the
-command is to be applied to all sources whose IPv6 addresses have first
-48 bits equal to @code{2001:db8:789a}. The fourth form means that the command
-is to be applied only to that one source.
-
-The wildcard form of the address is actually equivalent to
-
-@example
-offline 0.0.0.0/0.0.0.0
-offline ::/0
-@end example
-@c }}}
-@c {{{ online
-@node online command
-@subsubsection online
-The @code{online} command is opposite in function to the @code{offline}
-command. It is used to advise @code{chronyd} that network connectivity to a
-particular source or sources has been restored.
-
-The syntax is identical to that of the @code{offline} command, see
-@ref{offline command}.
-@c }}}
-@c {{{ polltarget
-@node polltarget command
-@subsubsection polltarget
-The @code{polltarget} command is used to modify the poll target for
-one of the current set of sources. It is equivalent to the
-@code{polltarget} option in the @code{server} directive in the
-configuration file (@pxref{server directive}).
-
-The syntax is as follows
-
-@example
-polltarget <host> <new-poll-target>
-@end example
-
-where the host can be specified as either a machine name or
-IP address.
-
-An example is
-
-@example
-polltarget foo.example.net 12
-@end example
-
-which sets the poll target for the host @code{foo.example.net}
-to 12.
-@c }}}
-@c {{{ quit
-@node quit command
-@subsubsection quit
-The quit command exits from chronyc and returns the user to the shell
-(same as the exit command).
-@c }}}
-@c {{{ refresh command
-@node refresh command
-@subsubsection refresh
-The @code{refresh} command can be used to force @code{chronyd} to resolve the
-names of configured sources to IP addresses again, e.g. after suspending and
-resuming the machine in a different network.
-
-Sources that stop responding will be replaced with newly resolved addresses
-automatically after 8 polling intervals, but this command may still be useful
-to replace them immediately and not wait until they are marked as unreachable.
-@c }}}
-@c {{{ reselect command
-@node reselect command
-@subsubsection reselect
-To avoid excessive switching between sources, @code{chronyd} may stay
-synchronised to a source even when it is not currently the best one among the
-available sources.
-
-The @code{reselect} command can be used to force @code{chronyd} to
-reselect the best synchronisation source.
-@c }}}
-@c {{{ reselectdist command
-@node reselectdist command
-@subsubsection reselectdist
-The @code{reselectdist} command sets the reselect distance. It is equivalent
-to the @code{reselectdist} directive in the configuration file
-(@pxref{reselectdist directive}).
-@c }}}
-@c {{{ retries
-@node retries command
-@subsubsection retries
-The @code{retries} command sets the maximum number of retries for
-@code{chronyc} requests before giving up. The response timeout is controlled
-by @code{timeout} command (@pxref{timeout command}).
-
-The default is 2.
-@c }}}
-@c {{{ rtcdata
-@node rtcdata command
-@subsubsection rtcdata
-The @code{rtcdata} command displays the current real time clock RTC parameters.
-
-An example output is shown below.
-
-@example
-RTC ref time (GMT) : Sat May 30 07:25:56 1998
-Number of samples : 10
-Number of runs : 5
-Sample span period : 549
-RTC is fast by : -1.632736 seconds
-RTC gains time at : -107.623 ppm
-@end example
-
-The fields have the following meaning
-
-@table @code
-@item RTC ref time (GMT)
-This is the RTC reading the last time its error was measured.
-@item Number of samples
-This is the number of previous measurements being used to determine the
-RTC gain/loss rate.
-@item Number of runs
-This is the number of runs of residuals of the same sign following the
-regression fit for (RTC error) versus (RTC time). A value which is
-small indicates that the measurements are not well approximated by a
-linear model, and that the algorithm will tend to delete the older
-measurements to improve the fit.
-@item Sample span period
-This is the period that the measurements span (from the oldest to the
-newest). Without a unit the value is in seconds; suffixes `m' for
-minutes, `h' for hours, `d' for days or `y' for years may be used.
-@item RTC is fast by
-This is the estimate of how many seconds fast the RTC when it thought
-the time was at the reference time (above). If this value is large, you
-may (or may not) want to use the @code{trimrtc} command to bring the RTC
-into line with the system clock. (Note, a large error will not affect
-@code{chronyd's} operation, unless it becomes so big as to start causing
-rounding errors.
-@item RTC gains time at
-This is the amount of time gained (positive) or lost (negative) by the
-real time clock for each second that it ticks. It is measured in parts
-per million. So if the value shown was +1, suppose the RTC was exactly
-right when it crosses a particular second boundary. Then it would be 1
-microsecond fast when it crosses its next second boundary.
-@end table
-@c }}}
-@c {{{ serverstats command
-@node serverstats command
-@subsubsection serverstats command
-The @code{serverstats} command displays how many valid NTP and command requests
-@code{chronyd} as a server received from clients, how many of them were dropped
-to limit the response rate as configured by the @code{ratelimit} and
-@code{cmdratelimit} directives, and how many client log records were dropped
-due to the memory limit configured by the @code{clientloglimit} directive. An
-example of the output is shown below.
-
-@example
-NTP packets received : 1598
-NTP packets dropped : 8
-Command packets received : 19
-Command packets dropped : 0
-Client log records dropped : 0
-@end example
-@c }}}
-@c {{{ settime
-@node settime command
-@subsubsection settime
-The @code{settime} command allows the current time to be entered
-manually, if this option has been configured into @code{chronyd}. (It may be
-configured either with the @code{manual} directive in the configuration
-file (@pxref{manual directive}), or with the @code{manual} command of
-chronyc (@pxref{manual command}).
-
-It should be noted that the computer's sense of time will only be as
-accurate as the reference you use for providing this input (e.g. your
-watch), as well as how well you can time the press of the return key.
-
-Providing your computer's time zone is set up properly, you will be able
-to enter a local time (rather than UTC).
-
-The response to a successful @code{settime} command indicates the amount
-that the computer's clock was wrong. It should be apparent from this if
-you have entered the time wrongly, e.g. with the wrong time zone.
-
-The rate of drift of the system clock is estimated by a regression
-process using the entered measurement and all previous measurements
-entered during the present run of @code{chronyd}. However, the entered
-measurement is used for adjusting the current clock offset (rather than
-the estimated intercept from the regression, which is ignored).
-Contrast what happens with the @code{manual delete} command, where the
-intercept is used to set the current offset (since there is no
-measurement that has just been typed in in that case).
-
-The time is parsed by the public domain @file{getdate} algorithm.
-Consequently, you can only specify time to the nearest second.
-
-Examples of inputs that are valid are shown below.
-
-@example
-settime 16:30
-settime 16:30:05
-settime Nov 21, 1997 16:30:05
-@end example
-
-For a full description of @code{getdate}, get hold of the getdate
-documentation (bundled, for example, with the source for GNU tar).
-@c }}}
-@c {{{ smoothing
-@node smoothing command
-@subsubsection smoothing
-The @code{smoothing} command displays the current state of the NTP server time
-smoothing. An example of the output is shown below.
-
-@example
-Active : Yes
-Offset : +1.000268817 seconds
-Frequency : -0.142859 ppm
-Wander : -0.010000 ppm per second
-Last update : 17.8 seconds ago
-Remaining time : 19988.4 seconds
-@end example
-
-The fields are explained as follows.
-
-@table @code
-@item Active
-This shows if the server time smoothing is currently active. Possible values
-are @code{Yes} and @code{No}. If the @code{leaponly} option is included in the
-@code{smoothtime} directive, @code{(leap second only)} will be shown on the
-line.
-
-@item Offset
-This is the current offset applied to the time sent to NTP clients. Positive
-value means the clients are getting time that's ahead of true time.
-
-@item Frequency
-The current frequency offset of the served time. Negative value means the time
-observed by clients is running slower than true time.
-
-@item Wander
-The current frequency wander of the served time. Negative value means the time
-observed by clients is slowing down.
-
-@item Last update
-This field shows how long ago was the time smoothing process updated, e.g.
-@code{chronyd} accumulated a new measurement.
-
-@item Remaining time
-The time it would take for the smoothing process to get to zero offset and
-frequency if there were no more updates.
-@end table
-@c }}}
-@c {{{ smoothtime
-@node smoothtime command
-@subsubsection smoothtime
-The @code{smoothtime} command can be used to reset or activate the server time
-smoothing process if it is configured with the @code{smoothtime} directive
-(@pxref{smoothtime directive}).
-
-The syntax is as follows
-
-@example
-smoothtime reset
-smoothtime activate
-@end example
-
-@c }}}
-@c {{{ sources
-@node sources command
-@subsubsection sources
-This command displays information about the current time sources that
-@code{chronyd} is accessing.
-
-The optional argument @code{-v} can be specified, meaning @emph{verbose}. In
-this case, extra caption lines are shown as a reminder of the meanings of the
-columns.
-
-@example
-@group
-210 Number of sources = 3
-MS Name/IP address Stratum Poll Reach LastRx Last sample
-===============================================================================
-#* GPS0 0 4 377 11 -479ns[ -621ns] +/- 134ns
-^? foo.example.net 2 6 377 23 -923us[ -924us] +/- 43ms
-^+ bar.example.net 1 6 377 21 -2629us[-2619us] +/- 86ms
-@end group
-@end example
-
-The columns are as follows:
-
-@table @code
-@item M
-This indicates the mode of the source. @code{^} means a server,
-@code{=} means a peer and @code{#} indicates a locally connected
-reference clock.
-
-@item S
-This column indicates the state of the sources. @code{*} indicates the
-source to which @code{chronyd} is currently synchronised. @code{+}
-indicates acceptable sources which are combined with the selected
-source. @code{-} indicates acceptable sources which are excluded by
-the combining algorithm. @code{?} indicates sources to which
-connectivity has been lost or whose packets don't pass all tests.
-@code{x} indicates a clock which @code{chronyd}
-thinks is is a falseticker (i.e. its time is inconsistent with a
-majority of other sources). @code{~} indicates a source whose time
-appears to have too much variability. The @code{?} condition is also
-shown at start-up, until at least 3 samples have been gathered from it.
-
-@item Name/IP address
-This shows the name or the IP address of the source, or refid for
-reference clocks.
-
-@item Stratum
-This shows the stratum of the source, as reported in its most recently
-received sample. Stratum 1 indicates a computer with a locally attached
-reference clock. A computer that is synchronised to a stratum 1
-computer is at stratum 2. A computer that is synchronised to a stratum
-2 computer is at stratum 3, and so on.
-
-@item Poll
-This shows the rate at which the source is being polled, as a base-2
-logarithm of the interval in seconds. Thus, a value of 6 would indicate
-that a measurement is being made every 64 seconds.
-
-@code{chronyd} automatically varies the polling rate in response to prevailing
-conditions.
-
-@item Reach
-This shows the source's reachability register printed as octal number. The
-register has 8 bits and is updated on every received or missed packet from
-the source. A value of 377 indicates that a valid reply was received for all
-from the last eight transmissions.
-
-@item LastRx
-This column shows how long ago the last sample was received from the
-source. This is normally in seconds. The letters @code{m}, @code{h},
-@code{d} or @code{y} indicate minutes, hours, days or years. A value
-of 10 years indicates there were no samples received from this source
-yet.
-
-@item Last sample
-This column shows the offset between the local clock and the source at
-the last measurement. The number in the square brackets shows the
-actual measured offset. This may be suffixed by @code{ns} (indicating
-nanoseconds), @code{us} (indicating
-microseconds), @code{ms} (indicating milliseconds), or @code{s}
-(indicating seconds). The number to the left of the square brackets
-shows the original measurement, adjusted to allow for any slews applied
-to the local clock since. The number following the @code{+/-} indicator
-shows the margin of error in the measurement.
-
-Positive offsets indicate that the local clock is fast of the source.
-
-@end table
-@c }}}
-@c {{{ sourcestats
-@node sourcestats command
-@subsubsection sourcestats
-
-The @code{sourcestats} command displays information about the drift rate
-and offset estimatation process for each of the sources currently being
-examined by @code{chronyd}.
-
-The optional argument @code{-v} can be specified, meaning @emph{verbose}. In
-this case, extra caption lines are shown as a reminder of the meanings of the
-columns.
-
-An example report is
-
-@example
-@group
-210 Number of sources = 1
-Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
-===============================================================================
-abc.def.ghi 11 5 46m -0.001 0.045 1us 25us
-@end group
-@end example
-
-The columns are as follows
-
-@table @code
-@item Name/IP Address
-This is the name or IP address of the NTP server (or peer) or refid of
-the refclock to which the rest of the line relates.
-
-@item NP
-This is the number of sample points currently being retained for the
-server. The drift rate and current offset are estimated by performing a
-linear regression through these points.
-
-@item NR
-This is the number of runs of residuals having the same sign following
-the last regression. If this number starts to become too small relative
-to the number of samples, it indicates that a straight line is no longer
-a good fit to the data. If the number of runs is too low,
-@code{chronyd} discards older samples and re-runs the regression until
-the number of runs becomes acceptable.
-
-@item Span
-This is the interval between the oldest and newest samples. If no unit
-is shown the value is in seconds. In the example, the interval is 46
-minutes.
-
-@item Frequency
-This is the estimated residual frequency for the server, in parts per
-million. In this case, the computer's clock is estimated to be running
-1 part in 10**9 slow relative to the server.
-
-@item Freq Skew
-This is the estimated error bounds on @code{Freq} (again in parts per
-million).
-
-@item Offset
-This is the estimated offset of the source.
-
-@item Std Dev
-This is the estimated sample standard deviation.
-
-@end table
-@c }}}
-@c {{{ timeout
-@node timeout command
-@subsubsection timeout
-The @code{timeout} command sets the initial timeout for @code{chronyc} requests
-in milliseconds. If no response is received from @code{chronyd}, the timeout is
-doubled and the request is resent. The maximum number of retries is configured
-with the @code{retries} command (@pxref{retries command}).
-
-By default, the timeout is 1000 milliseconds.
-@c }}}
-@c {{{ tracking
-@node tracking command
-@subsubsection tracking
-The @code{tracking} command displays parameters about the system's clock
-performance. An example of the output is shown below.
-
-@example
-Reference ID : 1.2.3.4 (foo.example.net)
-Stratum : 3
-Ref time (UTC) : Fri Feb 3 15:00:29 2012
-System time : 0.000001501 seconds slow of NTP time
-Last offset : -0.000001632 seconds
-RMS offset : 0.000002360 seconds
-Frequency : 331.898 ppm fast
-Residual freq : 0.004 ppm
-Skew : 0.154 ppm
-Root delay : 0.373169 seconds
-Root dispersion : 0.024780 seconds
-Update interval : 64.2 seconds
-Leap status : Normal
-
-@end example
-
-The fields are explained as follows.
-
-@table @code
-@item Reference ID
-This is the refid and name (or IP address) if available, of the server to which
-the computer is currently synchronised. If this is @code{127.127.1.1}
-it means the computer is not synchronised to any external source and
-that you have the `local' mode operating (via the @code{local} command
-in @code{chronyc} (@pxref{local command}), or the @code{local} directive
-in the @file{@SYSCONFDIR@/chrony.conf} file (@pxref{local directive})).
-
-@item Stratum
-The stratum indicates how many hops away from a computer with an
-attached reference clock we are. Such a computer is a stratum-1
-computer, so the computer in the example is two hops away
-(i.e. @code{foo.example.net} is a stratum-2 and is synchronised from a stratum-1).
-
-@item Ref time
-This is the time (UTC) at which the last measurement from the reference
-source was processed.
-
-@item System time
-In normal operation, @code{chronyd} @emph{never} steps the system clock,
-because any jump in the timescale can have adverse consequences for
-certain application programs. Instead, any error in the system clock is
-corrected by slightly speeding up or slowing down the system clock until
-the error has been removed, and then returning to the system clock's
-normal speed. A consequence of this is that there will be a period when
-the system clock (as read by other programs using the
-@code{gettimeofday()} system call, or by the @code{date} command in the
-shell) will be different from @code{chronyd's} estimate of the current
-true time (which it reports to NTP clients when it is operating in
-server mode). The value reported on this line is the difference due to
-this effect.
-
-@item Last offset
-This is the estimated local offset on the last clock update.
-
-@item RMS offset
-This is a long-term average of the offset value.
-
-@item Frequency
-The `frequency' is the rate by which the system's clock would be would
-be wrong if @code{chronyd} was not correcting it. It is expressed in
-ppm (parts per million). For example, a value of 1ppm would mean that
-when the system's clock thinks it has advanced 1 second, it has actually
-advanced by 1.000001 seconds relative to true time.
-
-As you can see in the example, the clock in the computer is not a very
-good one - it gains about 30 seconds per day!
-
-@item Residual freq
-This shows the `residual frequency' for the currently selected reference
-source. This reflects any difference between what the measurements from
-the reference source indicate the frequency should be and the frequency
-currently being used.
-
-The reason this is not always zero is that a smoothing procedure is
-applied to the frequency. Each time a measurement from the reference
-source is obtained and a new residual frequency computed, the estimated
-accuracy of this residual is compared with the estimated accuracy (see
-`skew' next) of the existing frequency value. A weighted average is
-computed for the new frequency, with weights depending on these
-accuracies. If the measurements from the reference source follow a
-consistent trend, the residual will be driven to zero over time.
-
-@item Skew
-This is the estimated error bound on the the frequency.
-
-@item Root delay
-This is the total of the network path delays to the stratum-1 computer
-from which the computer is ultimately synchronised.
-
-@item Root dispersion
-This is the total dispersion accumulated through all the computers back
-to the stratum-1 computer from which the computer is ultimately
-synchronised. Dispersion is due to system clock resolution, statistical
-measurement variations etc.
-
-An absolute bound on the computer's clock accuracy (assuming the
-stratum-1 computer is correct) is given by
-
-@example
-clock_error <= root_dispersion + (0.5 * |root_delay|)
-@end example
-
-@item Update interval
-This is the interval between the last two clock updates.
-
-@item Leap status
-This is the leap status, which can be @code{Normal}, @code{Insert second},
-@code{Delete second} or @code{Not synchronised}.
-
-@end table
-@c }}}
-@c {{{ trimrtc
-@node trimrtc command
-@subsubsection trimrtc
-The @code{trimrtc} command is used to correct the system's real time
-clock (RTC) to the main system clock. It has no effect if the error
-between the two clocks is currently estimated at less than a second (the
-resolution of the RTC is only 1 second).
-
-The command takes no arguments. It performs the following steps (if the
-RTC is more than 1 second away from the system clock):
-
-@enumerate 1
-@item
-Remember the currently estimated gain/loss rate of the RTC and flush the
-previous measurements.
-@item
-Step the real time clock to bring it within a second of the system clock.
-@item
-Make several measurements to accurately determine the new offset between
-the RTC and the system clock (i.e. the remaining fraction of a second
-error)
-@item
-Save the RTC parameters to the RTC file (specified with the
-@code{rtcfile} directive in the configuration file (@pxref{rtcfile
-directive}).
-@end enumerate
-
-The last step is done as a precaution against the computer suffering a
-power failure before either the daemon exits or the @code{writertc}
-command is issued.
-
-@code{chronyd} will still work perfectly well both whilst operating and
-across machine reboots even if the @code{trimrtc} command is never used
-(and the RTC is allowed to drift away from true time). The
-@code{trimrtc} command is provided as a method by which it can be
-corrected, in a manner compatible with @code{chronyd} using it to
-maintain accurate time across machine reboots.
-
-The @code{trimrtc} command can be executed automatically by @code{chronyd}
-with the @code{rtcautotrim} directive (@pxref{rtcautotrim directive}).
-@c }}}
-@c {{{ waitsync
-@node waitsync command
-@subsubsection waitsync
-The @code{waitsync} command waits for @code{chronyd} to synchronise.
-
-Up to four optional arguments can be specified, the first is the maximum
-number of tries before giving up and returning a non-zero error code. When 0
-is specified, or there are no arguments, the number of tries will not be
-limited.
-
-The second and third arguments are the maximum allowed remaining correction of
-the system clock and the maximum allowed skew (in ppm) as reported by the
-@code{tracking} command (@pxref{tracking command}) in the @code{System time}
-and @code{Skew} fields. If not specified or zero, the value will not be
-checked.
-
-The fourth argument is the interval in which the check is repeated. The
-interval is 10 seconds by default.
-
-An example is
-
-@example
-waitsync 60 0.01
-@end example
-
-which will wait up to about 10 minutes (60 times 10 seconds) for @code{chronyd}
-to synchronise to a source and the remaining correction to be less than 10
-milliseconds.
-@c }}}
-@c {{{ writertc
-@node writertc command
-@subsubsection writertc
-The @code{writertc} command writes the currently estimated error and
-gain/loss rate parameters for the RTC to the RTC file (specified with
-the @code{rtcfile} directive (@pxref{rtcfile directive})). This
-information is also written automatically when @code{chronyd} is killed
-(with SIGHUP, SIGINT, SIGQUIT or SIGTERM) or when the @code{trimrtc}
-command is issued.
-@c }}}
-@c }}}
-@c }}}
-@c }}}
-@c {{{ apx:GNU General Public License
-@node GPL
-@appendix GNU General Public License
-
-@center GNU GENERAL PUBLIC LICENSE
-@center Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
-@c }}}
-@contents
-@bye
-@c vim:cms=@c\ %s:fdm=marker:fdc=5:syntax=off
-
diff --git a/chronyc.1.in b/chronyc.1.in
deleted file mode 100644
index 2fcc7cb..0000000
--- a/chronyc.1.in
+++ /dev/null
@@ -1,74 +0,0 @@
-.TH CHRONYC 1 "February 2016" "chrony 2.3" "User's Manual"
-.SH NAME
-chronyc \- command-line interface for chronyd
-
-.SH SYNOPSIS
-.B chronyc
-[\fIOPTIONS\fR]
-
-.SH DESCRIPTION
-\fIchrony\fR is a pair of programs for maintaining the accuracy of computer
-clocks.
-
-\fBchronyc\fR is a command-line interface program which can be used to
-monitor \fIchronyd\fR's performance and to change various operating
-parameters whilst it is running.
-
-.SH USAGE
-A detailed description of all commands supported by \fBchronyc\fR is available
-via the documentation supplied with the distribution (\fIchrony.txt\fR and
-\fIchrony.texi\fR).
-
-.SH OPTIONS
-A summary of the options supported by \fBchronyc\fR is included below.
-
-.TP
-\fB\-h\fR \fIhostname\fR
-specify hostname or comma-separated list of addresses
-(default @CHRONYSOCKDIR@/chronyd.sock,127.0.0.1,::1)
-.TP
-\fB\-p\fR \fIport-number\fR
-specify port-number
-.TP
-\fB\-n\fR
-display raw IP addresses (don't attempt to look up hostnames)
-.TP
-\fB\-d\fR
-print debugging messages (if compiled with debugging support)
-.TP
-\fB\-4\fR
-resolve hostnames only to IPv4 addresses
-.TP
-\fB\-6\fR
-resolve hostnames only to IPv6 addresses
-.TP
-\fB\-m\fR
-allow multiple commands to be specified on the command line. Each argument
-will be interpreted as a whole command.
-.TP
-\fB\-f\fR \fIconf-file\fR
-this option is ignored and is provided only for compatibility.
-.TP
-\fB\-a\fR
-this option is ignored and is provided only for compatibility.
-.TP
-\fIcommand\fR
-specify command. If no command is given, chronyc will read commands
-interactively.
-
-.SH BUGS
-To report bugs, please visit \fIhttp://chrony.tuxfamily.org\fR
-
-.SH "SEE ALSO"
-.BR chronyd(8)
-
-.I http://chrony.tuxfamily.org/
-
-.SH AUTHOR
-Richard Curnow <rc@rc0.org.uk>
-
-This man-page was written by Jan Schaumann <jschauma@netmeister.org> as part of "The Missing
-Man Pages Project". Please see \fIhttp://www.netmeister.org/misc/m2p2/index.html\fR
-for details.
-
-The complete chrony documentation is supplied in texinfo format.
diff --git a/chronyd.8.in b/chronyd.8.in
deleted file mode 100644
index 4a3b4fc..0000000
--- a/chronyd.8.in
+++ /dev/null
@@ -1,166 +0,0 @@
-.TH CHRONYD 8 "February 2016" "chrony 2.3" "System Administration"
-.SH NAME
-chronyd \- chrony background daemon
-
-.SH SYNOPSIS
-.B chronyd
-[\fIOPTIONS\fR] [\fIconfiguration commands\fR]
-
-.SH DESCRIPTION
-\fIchrony\fR is a pair of programs for maintaining the accuracy of computer
-clocks. \fBchronyd\fR is a background daemon program that can be started at boot
-time.
-
-\fBchronyd\fR is a daemon which runs in background on the
-system. It obtains measurements (e.g. via the network) of the
-system's offset relative to other systems, and adjusts the system
-time accordingly. For isolated systems, the user can periodically
-enter the correct time by hand (using \fIchronyc\fR). In either case,
-\fBchronyd\fR determines the rate at which the computer
-gains or loses time, and compensates for this.
-
-.SH USAGE
-\fBchronyd\fR is usually started at boot-time and requires superuser
-privileges.
-
-If \fBchronyd\fR has been installed to its default location
-\fI@SBINDIR@/chronyd\fR, starting it is simply a matter of entering the
-command:
-
-\fI@SBINDIR@/chronyd\fR
-
-Information messages and warnings will be logged to syslog.
-
-If no configuration commands are specified on the command line,
-\fBchronyd\fR will read the commands from the configuration file
-(default \fI@SYSCONFDIR@/chrony.conf\fR).
-
-.SH OPTIONS
-A summary of the options supported by \fBchronyd\fR is included below.
-
-.TP
-\fB\-P\fR \fIpriority\fR
-On Linux, this option will select the SCHED_FIFO real-time scheduler at the
-specified priority (which must be between 0 and 100). On Mac OS X, this
-option must have either a value of 0 (the default) to disable the thread
-time constraint policy or 1 for the policy to be enabled. Other systems do not
-support this option.
-.TP
-.B \-m
-This option will lock chronyd into RAM so that it will never be paged out.
-This mode is only supported on Linux.
-.TP
-.B \-n
-When run in this mode, the program will not detach itself from the
-terminal.
-.TP
-.B \-d
-When run in this mode, the program will not detach itself from the
-terminal, and all messages will be sent to the terminal instead of
-to syslog. When \fBchronyd\fR was compiled with debugging support,
-this option can be used twice to print also debugging messages.
-.TP
-\fB\-f\fR \fIconf-file\fR
-This option can be used to specify an alternate location for the
-configuration file (default \fI@SYSCONFDIR@/chrony.conf\fR).
-.TP
-.B \-r
-This option will reload sample histories for each of the servers being used.
-These histories are created by using the \fIdump\fR command in \fIchronyc\fR,
-or by setting the \fIdumponexit\fR directive in the configuration file. This
-option is useful if you want to stop and restart \fBchronyd\fR briefly for any
-reason, e.g. to install a new version. However, it should be used only on
-systems where the kernel can maintain clock compensation whilst not under
-\fBchronyd\fR's control (i.e. Linux, FreeBSD, NetBSD and Solaris).
-.TP
-.B \-R
-When this option is used, the \fIinitstepslew\fR directive and the
-\fImakestep\fR directive used with a positive limit will be ignored. This
-option is useful when restarting \fBchronyd\fR and can be used in conjunction
-with the \fB-r\fR option.
-.TP
-.B \-s
-This option will set the system clock from the computer's real-time clock or
-to the last modification time of the file specified by the \fIdriftfile\fR
-directive. Real-time clocks are supported only on Linux.
-
-If used in conjunction with the \fB-r\fR flag, \fBchronyd\fR will attempt
-to preserve the old samples after setting the system clock from
-the real time clock (RTC). This can be used to allow \fBchronyd\fR to
-perform long term averaging of the gain or loss rate across system
-reboots, and is useful for dial-up systems that are shut down when
-not in use. For this to work well, it relies on \fBchronyd\fR having
-been able to determine accurate statistics for the difference
-between the RTC and system clock last time the computer was on.
-
-If the last modification time of the drift file is later than the current time
-and the RTC time, the system time will be set to it to restore the time when
-\fBchronyd\fR was previously stopped. This is useful on computers that have no
-RTC or the RTC is broken (e.g. it has no battery).
-.TP
-\fB\-u\fR \fIuser\fR
-This option sets the name of the system user to which \fBchronyd\fR will switch
-after start in order to drop root privileges. It overrides the \fBuser\fR
-directive from the configuration file (default \fB@DEFAULT_USER@\fR).
-
-On Linux, \fBchronyd\fR needs to be compiled with support for the \fBlibcap\fR
-library. On Mac OS X, FreeBSD, NetBSD and Solaris \fBchronyd\fR forks into two
-processes. The child process retains root privileges, but can only perform a
-very limited range of privileged system calls on behalf of the parent.
-.TP
-\fB\-F\fR \fIlevel\fR
-This option configures a system call filter when \fBchronyd\fR is compiled with
-support for the Linux secure computing (seccomp) facility. In level 1 the
-process is killed when a forbidden system call is made, in level -1 the SYSSIG
-signal is thrown instead and in level 0 the filter is disabled (default 0).
-
-It's recommended to enable the filter only when it's known to work on the
-version of the system where \fBchrony\fR is installed as the filter needs to
-allow also system calls made from libraries that \fBchronyd\fR is using (e.g.
-libc) and different versions or implementations of the libraries may make
-different system calls. If the filter is missing some system call,
-\fBchronyd\fR could be killed even in normal operation.
-.TP
-.B \-q
-When run in this mode, chronyd will set the system clock once
-and exit. It will not detach from the terminal.
-.TP
-.B \-Q
-This option is similar to \fB\-q\fR, but it will only print the offset and
-not correct the clock.
-.TP
-.B \-v
-This option displays \fBchronyd\fR's version number to the terminal and exits
-.TP
-.B \-4
-Resolve hostnames only to IPv4 addresses and create only IPv4 sockets.
-.TP
-.B \-6
-Resolve hostnames only to IPv6 addresses and create only IPv6 sockets.
-
-.SH FILES
-\fI@SYSCONFDIR@/chrony.conf\fR
-
-.SH BUGS
-To report bugs, please visit \fIhttp://chrony.tuxfamily.org/\fR
-
-.SH "SEE ALSO"
-\fBchronyd\fR is documented in detail in the documentation supplied with the
-distribution (\fIchrony.txt\fR and \fIchrony.texi\fR).
-
-.BR chronyc(1),
-.BR chrony.conf(5),
-.BR hwclock(8),
-.BR ntpd(8)
-
-.I http://chrony.tuxfamily.org/
-
-.SH AUTHOR
-Richard Curnow <rc@rc0.org.uk>
-
-This man-page was written by Jan Schaumann <jschauma@netmeister.org> as part
-of "The Missing Man Pages Project". Please see
-\fIhttp://www.netmeister.org/misc/m2p2/index.html\fR for details.
-
-The complete chrony documentation is supplied in texinfo format.
-
diff --git a/client.c b/client.c
index 6d729bf..b00fc77 100644
--- a/client.c
+++ b/client.c
@@ -70,6 +70,8 @@ static int on_terminal = 0;
static int no_dns = 0;
+static int csv_mode = 0;
+
/* ================================================== */
/* Log a message. This is a minimalistic replacement of the logging.c
implementation to avoid linking with it and other modules. */
@@ -715,25 +717,26 @@ process_cmd_burst(CMD_Request *msg, char *line)
/* ================================================== */
static int
-process_cmd_local(CMD_Request *msg, const char *line)
+process_cmd_local(CMD_Request *msg, char *line)
{
- const char *p;
- int stratum;
+ int on_off, stratum = 0, orphan = 0;
+ double distance = 0.0;
- p = line;
-
- if (!strcmp(p, "off")) {
- msg->data.local.on_off = htonl(0);
- msg->data.local.stratum = htonl(0);
- } else if (sscanf(p, "stratum%d", &stratum) == 1) {
- msg->data.local.on_off = htonl(1);
- msg->data.local.stratum = htonl(stratum);
+ if (!strcmp(line, "off")) {
+ on_off = 0;
+ } else if (CPS_ParseLocal(line, &stratum, &orphan, &distance)) {
+ on_off = 1;
} else {
LOG(LOGS_ERR, LOGF_Client, "Invalid syntax for local command");
return 0;
}
- msg->command = htons(REQ_LOCAL);
+ msg->command = htons(REQ_LOCAL2);
+ msg->data.local.on_off = htonl(on_off);
+ msg->data.local.stratum = htonl(stratum);
+ msg->data.local.distance = UTI_FloatHostToNetwork(distance);
+ msg->data.local.orphan = htonl(orphan);
+
return 1;
}
@@ -1198,6 +1201,7 @@ give_help(void)
"sources [-v]\0Display information about current sources\0"
"sourcestats [-v]\0Display statistics about collected measurements\0"
"reselect\0Force reselecting synchronisation source\0"
+ "reselectdist <dist>\0Modify reselection distance\0"
"\0\0"
"NTP sources:\0\0"
"activity\0Check how many NTP sources are online/offline\0"
@@ -1230,7 +1234,7 @@ give_help(void)
"allow all [<subnet>]\0Allow access to subnet and all children\0"
"deny [<subnet>]\0Deny access to subnet as a default\0"
"deny all [<subnet>]\0Deny access to subnet and all children\0"
- "local stratum <stratum>\0Serve time at stratum when not synchronised\0"
+ "local [options]\0Serve time even when not synchronised\0"
"local off\0Don't serve time when not synchronised\0"
"smoothtime reset|activate\0Reset/activate time smoothing\0"
"smoothing\0Display current time smoothing state\0"
@@ -1661,15 +1665,252 @@ print_clientlog_interval(int rate)
/* ================================================== */
+static void
+print_header(const char *header)
+{
+ int len;
+
+ if (csv_mode)
+ return;
+
+ printf("%s\n", header);
+
+ len = strlen(header);
+ while (len--)
+ printf("=");
+ printf("\n");
+}
+
+/* ================================================== */
+
+#define REPORT_END 0x1234
+
+/* Print a report. The syntax of the format is similar to printf(), but not all
+ specifiers are supported and some are different! */
+
+static void
+print_report(const char *format, ...)
+{
+ char buf[256];
+ va_list ap;
+ int i, field, sign, width, prec, spec;
+ const char *string;
+ unsigned long long_uinteger;
+ unsigned int uinteger;
+ int integer;
+ struct timeval *tv;
+ struct tm *tm;
+ double dbl;
+
+ va_start(ap, format);
+
+ for (field = 0; ; field++) {
+ /* Search for text between format specifiers and print it
+ if not in the CSV mode */
+ for (i = 0; i < sizeof (buf) && format[i] != '%' && format[i] != '\0'; i++)
+ buf[i] = format[i];
+
+ if (i >= sizeof (buf))
+ break;
+
+ buf[i] = '\0';
+
+ if (!csv_mode)
+ printf("%s", buf);
+
+ if (format[i] == '\0' || format[i + 1] == '\0')
+ break;
+
+ format += i + 1;
+
+ sign = 0;
+ width = 0;
+ prec = 5;
+
+ if (*format == '+' || *format == '-') {
+ sign = 1;
+ format++;
+ }
+
+ if (isdigit((unsigned char)*format)) {
+ width = atoi(format);
+ while (isdigit((unsigned char)*format))
+ format++;
+ }
+
+ if (*format == '.') {
+ format++;
+ prec = atoi(format);
+ while (isdigit((unsigned char)*format))
+ format++;
+ }
+
+ spec = *format;
+ format++;
+
+ /* Disable human-readable formatting in the CSV mode */
+ if (csv_mode) {
+ sign = width = 0;
+
+ if (field > 0)
+ printf(",");
+
+ switch (spec) {
+ case 'C':
+ spec = 'd';
+ break;
+ case 'F':
+ case 'P':
+ prec = 3;
+ spec = 'f';
+ break;
+ case 'O':
+ case 'S':
+ prec = 9;
+ spec = 'f';
+ break;
+ case 'I':
+ spec = 'U';
+ break;
+ case 'T':
+ spec = 'V';
+ break;
+ }
+ }
+
+ switch (spec) {
+ case 'C': /* clientlog interval */
+ integer = va_arg(ap, int);
+ print_clientlog_interval(integer);
+ break;
+ case 'F': /* absolute frequency in ppm with fast/slow keyword */
+ case 'O': /* absolute offset in seconds with fast/slow keyword */
+ dbl = va_arg(ap, double);
+ printf("%*.*f %s %s", width, prec, fabs(dbl),
+ spec == 'O' ? "seconds" : "ppm",
+ (dbl > 0.0) ^ (spec != 'O') ? "slow" : "fast");
+ break;
+ case 'I': /* interval with unit */
+ long_uinteger = va_arg(ap, unsigned long);
+ print_seconds(long_uinteger);
+ break;
+ case 'P': /* frequency in ppm */
+ dbl = va_arg(ap, double);
+ if (sign)
+ print_signed_freq_ppm(dbl);
+ else
+ print_freq_ppm(dbl);
+ break;
+ case 'R': /* reference ID in quad-dotted notation */
+ long_uinteger = va_arg(ap, unsigned long);
+ printf("%lu.%lu.%lu.%lu", long_uinteger >> 24, (long_uinteger >> 16) & 0xff,
+ (long_uinteger >> 8) & 0xff, long_uinteger & 0xff);
+ break;
+ case 'S': /* offset with unit */
+ dbl = va_arg(ap, double);
+ if (sign)
+ print_signed_nanoseconds(dbl);
+ else
+ print_nanoseconds(dbl);
+ break;
+ case 'T': /* timeval as date and time in UTC */
+ tv = va_arg(ap, struct timeval *);
+ tm = gmtime(&tv->tv_sec);
+ if (!tm)
+ break;
+ strftime(buf, sizeof (buf), "%a %b %d %T %Y", tm);
+ printf("%s", buf);
+ break;
+ case 'U': /* unsigned long in decimal */
+ long_uinteger = va_arg(ap, unsigned long);
+ printf("%*lu", width, long_uinteger);
+ break;
+ case 'V': /* timeval as seconds since epoch */
+ tv = va_arg(ap, struct timeval *);
+ printf("%s", UTI_TimevalToString(tv));
+ break;
+
+ /* Classic printf specifiers */
+ case 'c': /* character */
+ integer = va_arg(ap, int);
+ printf("%c", integer);
+ break;
+ case 'd': /* signed int in decimal */
+ integer = va_arg(ap, int);
+ printf("%*d", width, integer);
+ break;
+ case 'f': /* double */
+ dbl = va_arg(ap, double);
+ printf(sign ? "%+*.*f" : "%*.*f", width, prec, dbl);
+ break;
+ case 'o': /* unsigned int in octal */
+ uinteger = va_arg(ap, unsigned int);
+ printf("%*o", width, uinteger);
+ break;
+ case 's': /* string */
+ string = va_arg(ap, const char *);
+ if (sign)
+ printf("%-*s", width, string);
+ else
+ printf("%*s", width, string);
+ break;
+ case 'u': /* unsigned int in decimal */
+ uinteger = va_arg(ap, unsigned int);
+ printf("%*u", width, uinteger);
+ break;
+ }
+ }
+
+ /* Require terminating argument to catch bad type conversions */
+ if (va_arg(ap, int) != REPORT_END)
+ assert(0);
+
+ va_end(ap);
+
+ if (csv_mode)
+ printf("\n");
+}
+
+/* ================================================== */
+
+static void
+print_info_field(const char *format, ...)
+{
+ va_list ap;
+
+ if (csv_mode)
+ return;
+
+ va_start(ap, format);
+ vprintf(format, ap);
+ va_end(ap);
+}
+
+/* ================================================== */
+
+static void
+format_name(char *buf, int size, int trunc_dns, int ref, uint32_t ref_id,
+ IPAddr *ip_addr)
+{
+ if (ref) {
+ snprintf(buf, size, "%s", UTI_RefidToString(ref_id));
+ } else if (no_dns || csv_mode) {
+ snprintf(buf, size, "%s", UTI_IPToString(ip_addr));
+ } else {
+ DNS_IPAddress2Name(ip_addr, buf, size);
+ if (size > trunc_dns)
+ buf[trunc_dns] = '\0';
+ }
+}
+
+/* ================================================== */
+
static int
check_for_verbose_flag(char *line)
{
- char *p = line;
- if (!strcmp(p, "-v")) {
+ if (!csv_mode && !strcmp(line, "-v"))
return 1;
- } else {
- return 0;
- }
+ return 0;
}
/* ================================================== */
@@ -1679,113 +1920,102 @@ process_cmd_sources(char *line)
{
CMD_Request request;
CMD_Reply reply;
- int n_sources, i;
- int verbose = 0;
-
- double orig_latest_meas, latest_meas, latest_meas_err;
IPAddr ip_addr;
- uint32_t latest_meas_ago;
- int16_t poll;
- uint16_t stratum, state, mode, flags, reachability;
- char hostname_buf[50];
+ uint32_t i, mode, n_sources;
+ char name[50], mode_ch, state_ch;
+ int verbose;
/* Check whether to output verbose headers */
verbose = check_for_verbose_flag(line);
request.command = htons(REQ_N_SOURCES);
- if (request_reply(&request, &reply, RPY_N_SOURCES, 0)) {
- n_sources = ntohl(reply.data.n_sources.n_sources);
- printf("210 Number of sources = %d\n", n_sources);
- if (verbose) {
- printf("\n");
- printf(" .-- Source mode '^' = server, '=' = peer, '#' = local clock.\n");
- printf(" / .- Source state '*' = current synced, '+' = combined , '-' = not combined,\n");
- printf("| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.\n");
- printf("|| .- xxxx [ yyyy ] +/- zzzz\n");
- printf("|| Reachability register (octal) -. | xxxx = adjusted offset,\n");
- printf("|| Log2(Polling interval) --. | | yyyy = measured offset,\n");
- printf("|| \\ | | zzzz = estimated error.\n");
- printf("|| | | \\\n");
- }
+ if (!request_reply(&request, &reply, RPY_N_SOURCES, 0))
+ return 0;
- printf("MS Name/IP address Stratum Poll Reach LastRx Last sample\n");
- printf("===============================================================================\n");
-
- /* "MS NNNNNNNNNNNNNNNNNNNNNNNNNNN SS PP RRR RRRR SSSSSSS[SSSSSSS] +/- SSSSSS" */
-
- for (i=0; i<n_sources; i++) {
- request.command = htons(REQ_SOURCE_DATA);
- request.data.source_data.index = htonl(i);
- if (request_reply(&request, &reply, RPY_SOURCE_DATA, 0)) {
- UTI_IPNetworkToHost(&reply.data.source_data.ip_addr, &ip_addr);
- poll = ntohs(reply.data.source_data.poll);
- stratum = ntohs(reply.data.source_data.stratum);
- state = ntohs(reply.data.source_data.state);
- mode = ntohs(reply.data.source_data.mode);
- flags = ntohs(reply.data.source_data.flags);
- reachability = ntohs(reply.data.source_data.reachability);
- latest_meas_ago = ntohl(reply.data.source_data.since_sample);
- orig_latest_meas = UTI_FloatNetworkToHost(reply.data.source_data.orig_latest_meas);
- latest_meas = UTI_FloatNetworkToHost(reply.data.source_data.latest_meas);
- latest_meas_err = UTI_FloatNetworkToHost(reply.data.source_data.latest_meas_err);
-
- if (mode == RPY_SD_MD_REF) {
- snprintf(hostname_buf, sizeof(hostname_buf), "%s", UTI_RefidToString(ip_addr.addr.in4));
- } else if (no_dns) {
- snprintf(hostname_buf, sizeof(hostname_buf), "%s", UTI_IPToString(&ip_addr));
- } else {
- DNS_IPAddress2Name(&ip_addr, hostname_buf, sizeof(hostname_buf));
- hostname_buf[25] = 0;
- }
+ n_sources = ntohl(reply.data.n_sources.n_sources);
+ print_info_field("210 Number of sources = %lu\n", (unsigned long)n_sources);
- switch (mode) {
- case RPY_SD_MD_CLIENT:
- printf("^"); break;
- case RPY_SD_MD_PEER:
- printf("="); break;
- case RPY_SD_MD_REF:
- printf("#"); break;
- default:
- printf(" ");
- }
- switch (state) {
- case RPY_SD_ST_SYNC:
- printf("*"); break;
- case RPY_SD_ST_UNREACH:
- printf("?"); break;
- case RPY_SD_ST_FALSETICKER:
- printf("x"); break;
- case RPY_SD_ST_JITTERY:
- printf("~"); break;
- case RPY_SD_ST_CANDIDATE:
- printf("+"); break;
- case RPY_SD_ST_OUTLIER:
- printf("-"); break;
- default:
- printf(" ");
- }
- switch (flags) {
- default:
- break;
- }
+ if (verbose) {
+ printf("\n");
+ printf(" .-- Source mode '^' = server, '=' = peer, '#' = local clock.\n");
+ printf(" / .- Source state '*' = current synced, '+' = combined , '-' = not combined,\n");
+ printf("| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.\n");
+ printf("|| .- xxxx [ yyyy ] +/- zzzz\n");
+ printf("|| Reachability register (octal) -. | xxxx = adjusted offset,\n");
+ printf("|| Log2(Polling interval) --. | | yyyy = measured offset,\n");
+ printf("|| \\ | | zzzz = estimated error.\n");
+ printf("|| | | \\\n");
+ }
- printf(" %-27s %2d %2d %3o ", hostname_buf, stratum, poll, reachability);
- print_seconds(latest_meas_ago);
- printf(" ");
- print_signed_nanoseconds(latest_meas);
- printf("[");
- print_signed_nanoseconds(orig_latest_meas);
- printf("]");
- printf(" +/- ");
- print_nanoseconds(latest_meas_err);
- printf("\n");
- } else {
- return 0;
- }
+ print_header("MS Name/IP address Stratum Poll Reach LastRx Last sample ");
+
+ /* "MS NNNNNNNNNNNNNNNNNNNNNNNNNNN SS PP RRR RRRR SSSSSSS[SSSSSSS] +/- SSSSSS" */
+
+ for (i = 0; i < n_sources; i++) {
+ request.command = htons(REQ_SOURCE_DATA);
+ request.data.source_data.index = htonl(i);
+ if (!request_reply(&request, &reply, RPY_SOURCE_DATA, 0))
+ return 0;
+
+ mode = ntohs(reply.data.source_data.mode);
+ UTI_IPNetworkToHost(&reply.data.source_data.ip_addr, &ip_addr);
+ format_name(name, sizeof (name), 25, mode == RPY_SD_MD_REF,
+ ip_addr.addr.in4, &ip_addr);
+
+ switch (mode) {
+ case RPY_SD_MD_CLIENT:
+ mode_ch = '^';
+ break;
+ case RPY_SD_MD_PEER:
+ mode_ch = '=';
+ break;
+ case RPY_SD_MD_REF:
+ mode_ch = '#';
+ break;
+ default:
+ mode_ch = ' ';
}
- } else {
- return 0;
+
+ switch (ntohs(reply.data.source_data.state)) {
+ case RPY_SD_ST_SYNC:
+ state_ch = '*';
+ break;
+ case RPY_SD_ST_UNREACH:
+ state_ch = '?';
+ break;
+ case RPY_SD_ST_FALSETICKER:
+ state_ch = 'x';
+ break;
+ case RPY_SD_ST_JITTERY:
+ state_ch = '~';
+ break;
+ case RPY_SD_ST_CANDIDATE:
+ state_ch = '+';
+ break;
+ case RPY_SD_ST_OUTLIER:
+ state_ch = '-';
+ break;
+ default:
+ state_ch = ' ';
+ }
+
+ switch (ntohs(reply.data.source_data.flags)) {
+ default:
+ break;
+ }
+
+ print_report("%c%c %-27s %2d %2d %3o %I %+S[%+S] +/- %S\n",
+ mode_ch, state_ch, name,
+ ntohs(reply.data.source_data.stratum),
+ ntohs(reply.data.source_data.poll),
+ ntohs(reply.data.source_data.reachability),
+ (unsigned long)ntohl(reply.data.source_data.since_sample),
+ UTI_FloatNetworkToHost(reply.data.source_data.latest_meas),
+ UTI_FloatNetworkToHost(reply.data.source_data.orig_latest_meas),
+ UTI_FloatNetworkToHost(reply.data.source_data.latest_meas_err),
+ REPORT_END);
}
+
return 1;
}
@@ -1796,80 +2026,58 @@ process_cmd_sourcestats(char *line)
{
CMD_Request request;
CMD_Reply reply;
- int n_sources, i;
+ uint32_t i, n_sources;
int verbose = 0;
-
- char hostname_buf[50];
- unsigned long n_samples, n_runs, span_seconds;
- double resid_freq_ppm, skew_ppm, sd, est_offset;
- uint32_t ref_id;
+ char name[50];
IPAddr ip_addr;
verbose = check_for_verbose_flag(line);
request.command = htons(REQ_N_SOURCES);
- if (request_reply(&request, &reply, RPY_N_SOURCES, 0)) {
- n_sources = ntohl(reply.data.n_sources.n_sources);
- printf("210 Number of sources = %d\n", n_sources);
- if (verbose) {
- printf(" .- Number of sample points in measurement set.\n");
- printf(" / .- Number of residual runs with same sign.\n");
- printf(" | / .- Length of measurement set (time).\n");
- printf(" | | / .- Est. clock freq error (ppm).\n");
- printf(" | | | / .- Est. error in freq.\n");
- printf(" | | | | / .- Est. offset.\n");
- printf(" | | | | | | On the -.\n");
- printf(" | | | | | | samples. \\\n");
- printf(" | | | | | | |\n");
- }
+ if (!request_reply(&request, &reply, RPY_N_SOURCES, 0))
+ return 0;
- printf("Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev\n");
- printf("==============================================================================\n");
-
- /* NNNNNNNNNNNNNNNNNNNNNNNNN NP NR SSSS FFFFFFFFFF SSSSSSSSSS SSSSSSS SSSSSS*/
-
- for (i=0; i<n_sources; i++) {
- request.command = htons(REQ_SOURCESTATS);
- request.data.source_data.index = htonl(i);
- if (request_reply(&request, &reply, RPY_SOURCESTATS, 0)) {
- ref_id = ntohl(reply.data.sourcestats.ref_id);
- UTI_IPNetworkToHost(&reply.data.sourcestats.ip_addr, &ip_addr);
- n_samples = ntohl(reply.data.sourcestats.n_samples);
- n_runs = ntohl(reply.data.sourcestats.n_runs);
- span_seconds = ntohl(reply.data.sourcestats.span_seconds);
- resid_freq_ppm = UTI_FloatNetworkToHost(reply.data.sourcestats.resid_freq_ppm);
- skew_ppm = UTI_FloatNetworkToHost(reply.data.sourcestats.skew_ppm);
- sd = UTI_FloatNetworkToHost(reply.data.sourcestats.sd);
- est_offset = UTI_FloatNetworkToHost(reply.data.sourcestats.est_offset);
- /* est_offset_err = UTI_FloatNetworkToHost(reply.data.sourcestats.est_offset_err); */
-
- if (ip_addr.family == IPADDR_UNSPEC)
- snprintf(hostname_buf, sizeof(hostname_buf), "%s", UTI_RefidToString(ref_id));
- else if (no_dns) {
- snprintf(hostname_buf, sizeof(hostname_buf), "%s", UTI_IPToString(&ip_addr));
- } else {
- DNS_IPAddress2Name(&ip_addr, hostname_buf, sizeof(hostname_buf));
- hostname_buf[25] = 0;
- }
+ n_sources = ntohl(reply.data.n_sources.n_sources);
+ print_info_field("210 Number of sources = %lu\n", (unsigned long)n_sources);
- printf("%-25s %3lu %3lu ", hostname_buf, n_samples, n_runs);
- print_seconds(span_seconds);
- printf(" ");
- print_signed_freq_ppm(resid_freq_ppm);
- printf(" ");
- print_freq_ppm(skew_ppm);
- printf(" ");
- print_signed_nanoseconds(est_offset);
- printf(" ");
- print_nanoseconds(sd);
- printf("\n");
- } else {
- return 0;
- }
- }
- } else {
- return 0;
+ if (verbose) {
+ printf(" .- Number of sample points in measurement set.\n");
+ printf(" / .- Number of residual runs with same sign.\n");
+ printf(" | / .- Length of measurement set (time).\n");
+ printf(" | | / .- Est. clock freq error (ppm).\n");
+ printf(" | | | / .- Est. error in freq.\n");
+ printf(" | | | | / .- Est. offset.\n");
+ printf(" | | | | | | On the -.\n");
+ printf(" | | | | | | samples. \\\n");
+ printf(" | | | | | | |\n");
}
+
+ print_header("Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev");
+
+ /* "NNNNNNNNNNNNNNNNNNNNNNNNN NP NR SSSS FFFFFFFFFF SSSSSSSSSS SSSSSSS SSSSSS" */
+
+ for (i = 0; i < n_sources; i++) {
+ request.command = htons(REQ_SOURCESTATS);
+ request.data.source_data.index = htonl(i);
+ if (!request_reply(&request, &reply, RPY_SOURCESTATS, 0))
+ return 0;
+
+ UTI_IPNetworkToHost(&reply.data.sourcestats.ip_addr, &ip_addr);
+ format_name(name, sizeof (name), 25, ip_addr.family == IPADDR_UNSPEC,
+ ntohl(reply.data.sourcestats.ref_id), &ip_addr);
+
+ print_report("%-25s %3u %3u %I %+P %P %+S %S\n",
+ name,
+ (unsigned long)ntohl(reply.data.sourcestats.n_samples),
+ (unsigned long)ntohl(reply.data.sourcestats.n_runs),
+ (unsigned long)ntohl(reply.data.sourcestats.span_seconds),
+ UTI_FloatNetworkToHost(reply.data.sourcestats.resid_freq_ppm),
+ UTI_FloatNetworkToHost(reply.data.sourcestats.skew_ppm),
+ UTI_FloatNetworkToHost(reply.data.sourcestats.est_offset),
+ UTI_FloatNetworkToHost(reply.data.sourcestats.sd),
+ REPORT_END);
+ }
+
return 1;
}
@@ -1882,86 +2090,68 @@ process_cmd_tracking(char *line)
CMD_Reply reply;
IPAddr ip_addr;
uint32_t ref_id;
- char host[50];
- char *ref_ip;
+ char name[50];
struct timeval ref_time;
- struct tm ref_time_tm;
- unsigned long a, b, c, d;
- double correction;
- double last_offset;
- double rms_offset;
- double freq_ppm;
- double resid_freq_ppm;
- double skew_ppm;
- double root_delay;
- double root_dispersion;
- double last_update_interval;
const char *leap_status;
request.command = htons(REQ_TRACKING);
- if (request_reply(&request, &reply, RPY_TRACKING, 0)) {
- ref_id = ntohl(reply.data.tracking.ref_id);
- a = (ref_id >> 24);
- b = (ref_id >> 16) & 0xff;
- c = (ref_id >> 8) & 0xff;
- d = (ref_id) & 0xff;
-
- UTI_IPNetworkToHost(&reply.data.tracking.ip_addr, &ip_addr);
- if (ip_addr.family == IPADDR_UNSPEC) {
- ref_ip = UTI_RefidToString(ref_id);
- } else if (no_dns) {
- ref_ip = UTI_IPToString(&ip_addr);
- } else {
- DNS_IPAddress2Name(&ip_addr, host, sizeof (host));
- ref_ip = host;
- }
-
- switch (ntohs(reply.data.tracking.leap_status)) {
- case LEAP_Normal:
- leap_status = "Normal";
- break;
- case LEAP_InsertSecond:
- leap_status = "Insert second";
- break;
- case LEAP_DeleteSecond:
- leap_status = "Delete second";
- break;
- case LEAP_Unsynchronised:
- leap_status = "Not synchronised";
- break;
- default:
- leap_status = "Unknown";
- break;
- }
+ if (!request_reply(&request, &reply, RPY_TRACKING, 0))
+ return 0;
- printf("Reference ID : %lu.%lu.%lu.%lu (%s)\n", a, b, c, d, ref_ip);
- printf("Stratum : %lu\n", (unsigned long) ntohs(reply.data.tracking.stratum));
- UTI_TimevalNetworkToHost(&reply.data.tracking.ref_time, &ref_time);
- ref_time_tm = *gmtime((time_t *)&ref_time.tv_sec);
- printf("Ref time (UTC) : %s", asctime(&ref_time_tm));
- correction = UTI_FloatNetworkToHost(reply.data.tracking.current_correction);
- last_offset = UTI_FloatNetworkToHost(reply.data.tracking.last_offset);
- rms_offset = UTI_FloatNetworkToHost(reply.data.tracking.rms_offset);
- printf("System time : %.9f seconds %s of NTP time\n", fabs(correction),
- (correction > 0.0) ? "slow" : "fast");
- printf("Last offset : %+.9f seconds\n", last_offset);
- printf("RMS offset : %.9f seconds\n", rms_offset);
- freq_ppm = UTI_FloatNetworkToHost(reply.data.tracking.freq_ppm);
- resid_freq_ppm = UTI_FloatNetworkToHost(reply.data.tracking.resid_freq_ppm);
- skew_ppm = UTI_FloatNetworkToHost(reply.data.tracking.skew_ppm);
- root_delay = UTI_FloatNetworkToHost(reply.data.tracking.root_delay);
- root_dispersion = UTI_FloatNetworkToHost(reply.data.tracking.root_dispersion);
- last_update_interval = UTI_FloatNetworkToHost(reply.data.tracking.last_update_interval);
- printf("Frequency : %.3f ppm %s\n", fabs(freq_ppm), (freq_ppm < 0.0) ? "slow" : "fast");
- printf("Residual freq : %+.3f ppm\n", resid_freq_ppm);
- printf("Skew : %.3f ppm\n", skew_ppm);
- printf("Root delay : %.6f seconds\n", root_delay);
- printf("Root dispersion : %.6f seconds\n", root_dispersion);
- printf("Update interval : %.1f seconds\n", last_update_interval);
- printf("Leap status : %s\n", leap_status);
- return 1;
+ ref_id = ntohl(reply.data.tracking.ref_id);
+
+ UTI_IPNetworkToHost(&reply.data.tracking.ip_addr, &ip_addr);
+ format_name(name, sizeof (name), sizeof (name),
+ ip_addr.family == IPADDR_UNSPEC, ref_id, &ip_addr);
+
+ switch (ntohs(reply.data.tracking.leap_status)) {
+ case LEAP_Normal:
+ leap_status = "Normal";
+ break;
+ case LEAP_InsertSecond:
+ leap_status = "Insert second";
+ break;
+ case LEAP_DeleteSecond:
+ leap_status = "Delete second";
+ break;
+ case LEAP_Unsynchronised:
+ leap_status = "Not synchronised";
+ break;
+ default:
+ leap_status = "Unknown";
+ break;
}
- return 0;
+
+ UTI_TimevalNetworkToHost(&reply.data.tracking.ref_time, &ref_time);
+
+ print_report("Reference ID : %R (%s)\n"
+ "Stratum : %u\n"
+ "Ref time (UTC) : %T\n"
+ "System time : %.9O of NTP time\n"
+ "Last offset : %+.9f seconds\n"
+ "RMS offset : %.9f seconds\n"
+ "Frequency : %.3F\n"
+ "Residual freq : %+.3f ppm\n"
+ "Skew : %.3f ppm\n"
+ "Root delay : %.6f seconds\n"
+ "Root dispersion : %.6f seconds\n"
+ "Update interval : %.1f seconds\n"
+ "Leap status : %s\n",
+ (unsigned long)ref_id, name,
+ ntohs(reply.data.tracking.stratum),
+ &ref_time,
+ UTI_FloatNetworkToHost(reply.data.tracking.current_correction),
+ UTI_FloatNetworkToHost(reply.data.tracking.last_offset),
+ UTI_FloatNetworkToHost(reply.data.tracking.rms_offset),
+ UTI_FloatNetworkToHost(reply.data.tracking.freq_ppm),
+ UTI_FloatNetworkToHost(reply.data.tracking.resid_freq_ppm),
+ UTI_FloatNetworkToHost(reply.data.tracking.skew_ppm),
+ UTI_FloatNetworkToHost(reply.data.tracking.root_delay),
+ UTI_FloatNetworkToHost(reply.data.tracking.root_dispersion),
+ UTI_FloatNetworkToHost(reply.data.tracking.last_update_interval),
+ leap_status, REPORT_END);
+
+ return 1;
}
/* ================================================== */
@@ -1973,15 +2163,20 @@ process_cmd_serverstats(char *line)
CMD_Reply reply;
request.command = htons(REQ_SERVER_STATS);
-
if (!request_reply(&request, &reply, RPY_SERVER_STATS, 0))
return 0;
- printf("NTP packets received : %"PRIu32"\n", ntohl(reply.data.server_stats.ntp_hits));
- printf("NTP packets dropped : %"PRIu32"\n", ntohl(reply.data.server_stats.ntp_drops));
- printf("Command packets received : %"PRIu32"\n", ntohl(reply.data.server_stats.cmd_hits));
- printf("Command packets dropped : %"PRIu32"\n", ntohl(reply.data.server_stats.cmd_drops));
- printf("Client log records dropped : %"PRIu32"\n", ntohl(reply.data.server_stats.log_drops));
+ print_report("NTP packets received : %U\n"
+ "NTP packets dropped : %U\n"
+ "Command packets received : %U\n"
+ "Command packets dropped : %U\n"
+ "Client log records dropped : %U\n",
+ (unsigned long)ntohl(reply.data.server_stats.ntp_hits),
+ (unsigned long)ntohl(reply.data.server_stats.ntp_drops),
+ (unsigned long)ntohl(reply.data.server_stats.cmd_hits),
+ (unsigned long)ntohl(reply.data.server_stats.cmd_drops),
+ (unsigned long)ntohl(reply.data.server_stats.log_drops),
+ REPORT_END);
return 1;
}
@@ -1994,34 +2189,29 @@ process_cmd_smoothing(char *line)
CMD_Request request;
CMD_Reply reply;
uint32_t flags;
- double offset;
- double freq_ppm;
- double wander_ppm;
- double last_update_ago;
- double remaining_time;
request.command = htons(REQ_SMOOTHING);
+ if (!request_reply(&request, &reply, RPY_SMOOTHING, 0))
+ return 0;
- if (request_reply(&request, &reply, RPY_SMOOTHING, 0)) {
- flags = ntohl(reply.data.smoothing.flags);
- offset = UTI_FloatNetworkToHost(reply.data.smoothing.offset);
- freq_ppm = UTI_FloatNetworkToHost(reply.data.smoothing.freq_ppm);
- wander_ppm = UTI_FloatNetworkToHost(reply.data.smoothing.wander_ppm);
- last_update_ago = UTI_FloatNetworkToHost(reply.data.smoothing.last_update_ago);
- remaining_time = UTI_FloatNetworkToHost(reply.data.smoothing.remaining_time);
-
- printf("Active : %s%s\n",
- flags & RPY_SMT_FLAG_ACTIVE ? "Yes" : "No",
- flags & RPY_SMT_FLAG_LEAPONLY ? " (leap second only)" : "");
- printf("Offset : %+.9f seconds\n", offset);
- printf("Frequency : %+.6f ppm\n", freq_ppm);
- printf("Wander : %+.6f ppm per second\n", wander_ppm);
- printf("Last update : %.1f seconds ago\n", last_update_ago);
- printf("Remaining time : %.1f seconds\n", remaining_time);
- return 1;
- }
+ flags = ntohl(reply.data.smoothing.flags);
+
+ print_report("Active : %s %s\n"
+ "Offset : %+.9f seconds\n"
+ "Frequency : %+.6f ppm\n"
+ "Wander : %+.6f ppm per second\n"
+ "Last update : %.1f seconds ago\n"
+ "Remaining time : %.1f seconds\n",
+ flags & RPY_SMT_FLAG_ACTIVE ? "Yes" : "No",
+ flags & RPY_SMT_FLAG_LEAPONLY ? "(leap second only)" : "",
+ UTI_FloatNetworkToHost(reply.data.smoothing.offset),
+ UTI_FloatNetworkToHost(reply.data.smoothing.freq_ppm),
+ UTI_FloatNetworkToHost(reply.data.smoothing.wander_ppm),
+ UTI_FloatNetworkToHost(reply.data.smoothing.last_update_ago),
+ UTI_FloatNetworkToHost(reply.data.smoothing.remaining_time),
+ REPORT_END);
- return 0;
+ return 1;
}
/* ================================================== */
@@ -2051,33 +2241,28 @@ process_cmd_rtcreport(char *line)
CMD_Request request;
CMD_Reply reply;
struct timeval ref_time;
- struct tm ref_time_tm;
- unsigned short n_samples;
- unsigned short n_runs;
- unsigned long span_seconds;
- double coef_seconds_fast;
- double coef_gain_rate_ppm;
request.command = htons(REQ_RTCREPORT);
- if (request_reply(&request, &reply, RPY_RTC, 0)) {
- UTI_TimevalNetworkToHost(&reply.data.rtc.ref_time, &ref_time);
- ref_time_tm = *gmtime(&ref_time.tv_sec);
- n_samples = ntohs(reply.data.rtc.n_samples);
- n_runs = ntohs(reply.data.rtc.n_runs);
- span_seconds = ntohl(reply.data.rtc.span_seconds);
- coef_seconds_fast = UTI_FloatNetworkToHost(reply.data.rtc.rtc_seconds_fast);
- coef_gain_rate_ppm = UTI_FloatNetworkToHost(reply.data.rtc.rtc_gain_rate_ppm);
- printf("RTC ref time (UTC) : %s", asctime(&ref_time_tm));
- printf("Number of samples : %d\n", n_samples);
- printf("Number of runs : %d\n", n_runs);
- printf("Sample span period : ");
- print_seconds(span_seconds);
- printf("\n");
- printf("RTC is fast by : %12.6f seconds\n", coef_seconds_fast);
- printf("RTC gains time at : %9.3f ppm\n", coef_gain_rate_ppm);
- return 1;
- }
- return 0;
+ if (!request_reply(&request, &reply, RPY_RTC, 0))
+ return 0;
+
+ UTI_TimevalNetworkToHost(&reply.data.rtc.ref_time, &ref_time);
+
+ print_report("RTC ref time (UTC) : %T\n"
+ "Number of samples : %u\n"
+ "Number of runs : %u\n"
+ "Sample span period : %I\n"
+ "RTC is fast by : %12.6f seconds\n"
+ "RTC gains time at : %9.3f ppm\n",
+ &ref_time,
+ ntohs(reply.data.rtc.n_samples),
+ ntohs(reply.data.rtc.n_runs),
+ (unsigned long)ntohl(reply.data.rtc.span_seconds),
+ UTI_FloatNetworkToHost(reply.data.rtc.rtc_seconds_fast),
+ UTI_FloatNetworkToHost(reply.data.rtc.rtc_gain_rate_ppm),
+ REPORT_END);
+
+ return 1;
}
/* ================================================== */
@@ -2090,12 +2275,11 @@ process_cmd_clients(char *line)
IPAddr ip;
uint32_t i, n_clients, next_index, n_indices;
RPY_ClientAccesses_Client *client;
- char hostname[26];
+ char name[50];
next_index = 0;
- printf("Hostname NTP Drop Int IntL Last Cmd Drop Int Last\n"
- "===============================================================================\n");
+ print_header("Hostname NTP Drop Int IntL Last Cmd Drop Int Last");
while (1) {
request.command = htons(REQ_CLIENT_ACCESSES_BY_INDEX2);
@@ -2118,25 +2302,20 @@ process_cmd_clients(char *line)
if (ip.family == IPADDR_UNSPEC)
continue;
- if (no_dns)
- snprintf(hostname, sizeof (hostname), "%s", UTI_IPToString(&ip));
- else
- DNS_IPAddress2Name(&ip, hostname, sizeof (hostname));
-
- printf("%-25s", hostname);
- printf(" %6"PRIu32" %5"PRIu32" ",
- ntohl(client->ntp_hits), ntohl(client->ntp_drops));
- print_clientlog_interval(client->ntp_interval);
- printf(" ");
- print_clientlog_interval(client->ntp_timeout_interval);
- printf(" ");
- print_seconds(ntohl(client->last_ntp_hit_ago));
- printf(" %6"PRIu32" %5"PRIu32" ",
- ntohl(client->cmd_hits), ntohl(client->cmd_drops));
- print_clientlog_interval(client->cmd_interval);
- printf(" ");
- print_seconds(ntohl(client->last_cmd_hit_ago));
- printf("\n");
+ format_name(name, sizeof (name), sizeof (name), 0, 0, &ip);
+
+ print_report("%-25s %6U %5U %C %C %I %6U %5U %C %I\n",
+ name,
+ (unsigned long)ntohl(client->ntp_hits),
+ (unsigned long)ntohl(client->ntp_drops),
+ client->ntp_interval,
+ client->ntp_timeout_interval,
+ (unsigned long)ntohl(client->last_ntp_hit_ago),
+ (unsigned long)ntohl(client->cmd_hits),
+ (unsigned long)ntohl(client->cmd_drops),
+ client->cmd_interval,
+ (unsigned long)ntohl(client->last_cmd_hit_ago),
+ REPORT_END);
}
/* Set the next index to probe based on what the server tells us */
@@ -2157,29 +2336,32 @@ process_cmd_manual_list(const char *line)
{
CMD_Request request;
CMD_Reply reply;
- int n_samples;
+ uint32_t i, n_samples;
RPY_ManualListSample *sample;
- int i;
struct timeval when;
- double slewed_offset, orig_offset, residual;
request.command = htons(REQ_MANUAL_LIST);
- if (request_reply(&request, &reply, RPY_MANUAL_LIST, 0)) {
- n_samples = ntohl(reply.data.manual_list.n_samples);
- printf("210 n_samples = %d\n", n_samples);
- printf("# Date Time(UTC) Slewed Original Residual\n"
- "=======================================================\n");
- for (i=0; i<n_samples; i++) {
- sample = &reply.data.manual_list.samples[i];
- UTI_TimevalNetworkToHost(&sample->when, &when);
- slewed_offset = UTI_FloatNetworkToHost(sample->slewed_offset);
- orig_offset = UTI_FloatNetworkToHost(sample->orig_offset);
- residual = UTI_FloatNetworkToHost(sample->residual);
- printf("%2d %s %10.2f %10.2f %10.2f\n", i, UTI_TimeToLogForm(when.tv_sec), slewed_offset, orig_offset, residual);
- }
- return 1;
+ if (!request_reply(&request, &reply, RPY_MANUAL_LIST, 0))
+ return 0;
+
+ n_samples = ntohl(reply.data.manual_list.n_samples);
+ print_info_field("210 n_samples = %lu\n", (unsigned long)n_samples);
+
+ print_header("# Date Time(UTC) Slewed Original Residual");
+
+ for (i = 0; i < n_samples; i++) {
+ sample = &reply.data.manual_list.samples[i];
+ UTI_TimevalNetworkToHost(&sample->when, &when);
+
+ print_report("%2d %s %10.2f %10.2f %10.2f\n",
+ i, UTI_TimeToLogForm(when.tv_sec),
+ UTI_FloatNetworkToHost(sample->slewed_offset),
+ UTI_FloatNetworkToHost(sample->orig_offset),
+ UTI_FloatNetworkToHost(sample->residual),
+ REPORT_END);
}
- return 0;
+
+ return 1;
}
/* ================================================== */
@@ -2273,22 +2455,26 @@ process_cmd_activity(const char *line)
{
CMD_Request request;
CMD_Reply reply;
+
request.command = htons(REQ_ACTIVITY);
- if (request_reply(&request, &reply, RPY_ACTIVITY, 1)) {
- printf(
- "%ld sources online\n"
- "%ld sources offline\n"
- "%ld sources doing burst (return to online)\n"
- "%ld sources doing burst (return to offline)\n"
- "%ld sources with unknown address\n",
- (long) ntohl(reply.data.activity.online),
- (long) ntohl(reply.data.activity.offline),
- (long) ntohl(reply.data.activity.burst_online),
- (long) ntohl(reply.data.activity.burst_offline),
- (long) ntohl(reply.data.activity.unresolved));
- return 1;
- }
- return 0;
+ if (!request_reply(&request, &reply, RPY_ACTIVITY, 0))
+ return 0;
+
+ print_info_field("200 OK\n");
+
+ print_report("%U sources online\n"
+ "%U sources offline\n"
+ "%U sources doing burst (return to online)\n"
+ "%U sources doing burst (return to offline)\n"
+ "%U sources with unknown address\n",
+ (unsigned long)ntohl(reply.data.activity.online),
+ (unsigned long)ntohl(reply.data.activity.offline),
+ (unsigned long)ntohl(reply.data.activity.burst_online),
+ (unsigned long)ntohl(reply.data.activity.burst_offline),
+ (unsigned long)ntohl(reply.data.activity.unresolved),
+ REPORT_END);
+
+ return 1;
}
/* ================================================== */
@@ -2331,7 +2517,7 @@ process_cmd_waitsync(char *line)
{
CMD_Request request;
CMD_Reply reply;
- uint32_t ref_id, a, b, c, d;
+ uint32_t ref_id;
double correction, skew_ppm, max_correction, max_skew_ppm, interval;
int ret = 0, max_tries, i;
struct timeval timeout;
@@ -2352,17 +2538,13 @@ process_cmd_waitsync(char *line)
for (i = 1; ; i++) {
if (request_reply(&request, &reply, RPY_TRACKING, 0)) {
ref_id = ntohl(reply.data.tracking.ref_id);
- a = (ref_id >> 24);
- b = (ref_id >> 16) & 0xff;
- c = (ref_id >> 8) & 0xff;
- d = (ref_id) & 0xff;
correction = UTI_FloatNetworkToHost(reply.data.tracking.current_correction);
correction = fabs(correction);
skew_ppm = UTI_FloatNetworkToHost(reply.data.tracking.skew_ppm);
- printf("try: %d, refid: %d.%d.%d.%d, correction: %.9f, skew: %.3f\n",
- i, a, b, c, d, correction, skew_ppm);
+ print_report("try: %d, refid: %R, correction: %.9f, skew: %.3f\n",
+ i, (unsigned long)ref_id, correction, skew_ppm, REPORT_END);
if (ref_id != 0 && ref_id != 0x7f7f0101L /* LOCAL refid */ &&
(max_correction == 0.0 || correction <= max_correction) &&
@@ -2746,6 +2928,8 @@ main(int argc, char **argv)
/* For compatibility */
} else if (!strcmp(*argv, "-a")) {
/* For compatibility */
+ } else if (!strcmp(*argv, "-c")) {
+ csv_mode = 1;
} else if (!strcmp(*argv, "-d")) {
log_debug_enabled = 1;
} else if (!strcmp(*argv, "-m")) {
@@ -2761,7 +2945,7 @@ main(int argc, char **argv)
return 0;
} else if (!strncmp(*argv, "-", 1)) {
LOG(LOGS_ERR, LOGF_Client,
- "Usage: %s [-h HOST] [-p PORT] [-n] [-d] [-4|-6] [-m] [COMMAND]",
+ "Usage: %s [-h HOST] [-p PORT] [-n] [-c] [-d] [-4|-6] [-m] [COMMAND]",
progname);
return 1;
} else {
diff --git a/cmdmon.c b/cmdmon.c
index adaef8e..26622d2 100644
--- a/cmdmon.c
+++ b/cmdmon.c
@@ -132,6 +132,7 @@ static const char permissions[] = {
PERMIT_AUTH, /* REFRESH */
PERMIT_AUTH, /* SERVER_STATS */
PERMIT_AUTH, /* CLIENT_ACCESSES_BY_INDEX2 */
+ PERMIT_AUTH, /* LOCAL2 */
};
/* ================================================== */
@@ -248,43 +249,51 @@ prepare_socket(int family, int port_number)
/* ================================================== */
-void
-CAM_Initialise(int family)
+static void
+do_size_checks(void)
{
- int i, port_number;
+ int i, request_length, padding_length, reply_length;
+ CMD_Request request;
+ CMD_Reply reply;
- assert(!initialised);
- initialised = 1;
-
- assert(sizeof (permissions) / sizeof (permissions[0]) == N_REQUEST_TYPES);
+ assert(offsetof(CMD_Request, data) == 20);
+ assert(offsetof(CMD_Reply, data) == 28);
for (i = 0; i < N_REQUEST_TYPES; i++) {
- CMD_Request r;
- int command_length, padding_length;
-
- r.version = PROTO_VERSION_NUMBER;
- r.command = htons(i);
- command_length = PKL_CommandLength(&r);
- padding_length = PKL_CommandPaddingLength(&r);
- assert(padding_length <= MAX_PADDING_LENGTH && padding_length <= command_length);
- assert((command_length >= offsetof(CMD_Request, data) &&
- command_length <= sizeof (CMD_Request)) || command_length == 0);
+ request.version = PROTO_VERSION_NUMBER;
+ request.command = htons(i);
+ request_length = PKL_CommandLength(&request);
+ padding_length = PKL_CommandPaddingLength(&request);
+ if (padding_length > MAX_PADDING_LENGTH || padding_length > request_length ||
+ request_length > sizeof (CMD_Request) ||
+ (request_length && request_length < offsetof(CMD_Request, data)))
+ assert(0);
}
for (i = 1; i < N_REPLY_TYPES; i++) {
- CMD_Reply r;
- int reply_length;
-
- r.reply = htons(i);
- r.status = STT_SUCCESS;
- r.data.manual_list.n_samples = htonl(MAX_MANUAL_LIST_SAMPLES);
- reply_length = PKL_ReplyLength(&r);
- assert((reply_length >= offsetof(CMD_Reply, data) &&
- reply_length <= sizeof (CMD_Reply)) || reply_length == 0);
+ reply.reply = htons(i);
+ reply.status = STT_SUCCESS;
+ reply.data.manual_list.n_samples = htonl(MAX_MANUAL_LIST_SAMPLES);
+ reply_length = PKL_ReplyLength(&reply);
+ if ((reply_length && reply_length < offsetof(CMD_Reply, data)) ||
+ reply_length > sizeof (CMD_Reply))
+ assert(0);
}
+}
- sock_fdu = -1;
+/* ================================================== */
+
+void
+CAM_Initialise(int family)
+{
+ int port_number;
+ assert(!initialised);
+ assert(sizeof (permissions) / sizeof (permissions[0]) == N_REQUEST_TYPES);
+ do_size_checks();
+
+ initialised = 1;
+ sock_fdu = -1;
port_number = CNF_GetCommandPort();
if (port_number && (family == IPADDR_UNSPEC || family == IPADDR_INET4))
@@ -576,11 +585,10 @@ handle_settime(CMD_Request *rx_message, CMD_Reply *tx_message)
static void
handle_local(CMD_Request *rx_message, CMD_Reply *tx_message)
{
- int on_off, stratum;
- on_off = ntohl(rx_message->data.local.on_off);
- if (on_off) {
- stratum = ntohl(rx_message->data.local.stratum);
- REF_EnableLocal(stratum);
+ if (ntohl(rx_message->data.local.on_off)) {
+ REF_EnableLocal(ntohl(rx_message->data.local.stratum),
+ UTI_FloatNetworkToHost(rx_message->data.local.distance),
+ ntohl(rx_message->data.local.orphan));
} else {
REF_DisableLocal();
}
@@ -1409,7 +1417,7 @@ read_from_cmd_socket(void *anything)
handle_settime(&rx_message, &tx_message);
break;
- case REQ_LOCAL:
+ case REQ_LOCAL2:
handle_local(&rx_message, &tx_message);
break;
diff --git a/cmdparse.c b/cmdparse.c
index 591e2e4..b3f14de 100644
--- a/cmdparse.c
+++ b/cmdparse.c
@@ -3,7 +3,7 @@
**********************************************************************
* Copyright (C) Richard P. Curnow 1997-2003
- * Copyright (C) Miroslav Lichvar 2013-2014
+ * Copyright (C) Miroslav Lichvar 2013-2014, 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
@@ -223,6 +223,41 @@ CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src)
/* ================================================== */
+int
+CPS_ParseLocal(char *line, int *stratum, int *orphan, double *distance)
+{
+ int n;
+ char *cmd;
+
+ *stratum = 10;
+ *distance = 1.0;
+ *orphan = 0;
+
+ while (*line) {
+ cmd = line;
+ line = CPS_SplitWord(line);
+
+ if (!strcasecmp(cmd, "stratum")) {
+ if (sscanf(line, "%d%n", stratum, &n) != 1 ||
+ *stratum >= NTP_MAX_STRATUM || *stratum <= 0)
+ return 0;
+ } else if (!strcasecmp(cmd, "orphan")) {
+ *orphan = 1;
+ n = 0;
+ } else if (!strcasecmp(cmd, "distance")) {
+ if (sscanf(line, "%lf%n", distance, &n) != 1)
+ return 0;
+ } else {
+ return 0;
+ }
+
+ line += n;
+ }
+
+ return 1;
+}
+/* ================================================== */
+
void
CPS_StatusToString(CPS_Status status, char *dest, int len)
{
diff --git a/cmdparse.h b/cmdparse.h
index 3d18ade..a61fdc2 100644
--- a/cmdparse.h
+++ b/cmdparse.h
@@ -59,6 +59,9 @@ typedef struct {
/* Parse a command to add an NTP server or peer */
extern CPS_Status CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src);
+/* Parse a command to enable local reference */
+extern int CPS_ParseLocal(char *line, int *stratum, int *orphan, double *distance);
+
/* Get a string describing error status */
extern void CPS_StatusToString(CPS_Status status, char *dest, int len);
diff --git a/conf.c b/conf.c
index 682b971..94f4ee1 100644
--- a/conf.c
+++ b/conf.c
@@ -85,6 +85,7 @@ static char *rtc_file = NULL;
static double max_update_skew = 1000.0;
static double correction_time_ratio = 3.0;
static double max_clock_error = 1.0; /* in ppm */
+static double max_drift = 500000.0; /* in ppm */
static double max_slew_rate = 1e6 / 12.0; /* in ppm */
static double max_distance = 3.0;
@@ -107,6 +108,8 @@ static char *dumpdir;
static int enable_local=0;
static int local_stratum;
+static int local_orphan;
+static double local_distance;
/* Threshold (in seconds) - if absolute value of initial error is less
than this, slew instead of stepping */
@@ -489,6 +492,8 @@ CNF_ParseLine(const char *filename, int number, char *line)
parse_double(p, &max_clock_error);
} else if (!strcasecmp(command, "maxdistance")) {
parse_double(p, &max_distance);
+ } else if (!strcasecmp(command, "maxdrift")) {
+ parse_double(p, &max_drift);
} else if (!strcasecmp(command, "maxsamples")) {
parse_int(p, &max_samples);
} else if (!strcasecmp(command, "maxslewrate")) {
@@ -814,13 +819,9 @@ parse_log(char *line)
static void
parse_local(char *line)
{
- int stratum;
- if (sscanf(line, "stratum%d", &stratum) == 1) {
- local_stratum = stratum;
- enable_local = 1;
- } else {
+ if (!CPS_ParseLocal(line, &local_stratum, &local_orphan, &local_distance))
command_parse_error();
- }
+ enable_local = 1;
}
/* ================================================== */
@@ -1487,6 +1488,14 @@ CNF_GetMaxUpdateSkew(void)
/* ================================================== */
double
+CNF_GetMaxDrift(void)
+{
+ return max_drift;
+}
+
+/* ================================================== */
+
+double
CNF_GetMaxClockError(void)
{
return max_clock_error;
@@ -1558,10 +1567,12 @@ CNF_GetCommandPort(void) {
/* ================================================== */
int
-CNF_AllowLocalReference(int *stratum)
+CNF_AllowLocalReference(int *stratum, int *orphan, double *distance)
{
if (enable_local) {
*stratum = local_stratum;
+ *orphan = local_orphan;
+ *distance = local_distance;
return 1;
} else {
return 0;
diff --git a/conf.h b/conf.h
index b5ac5cf..7168fb3 100644
--- a/conf.h
+++ b/conf.h
@@ -83,6 +83,7 @@ extern char *CNF_GetLeapSecTimezone(void);
/* Value returned in ppm, as read from file */
extern double CNF_GetMaxUpdateSkew(void);
extern double CNF_GetMaxClockError(void);
+extern double CNF_GetMaxDrift(void);
extern double CNF_GetCorrectionTimeRatio(void);
extern double CNF_GetMaxSlewRate(void);
@@ -91,7 +92,7 @@ extern double CNF_GetReselectDistance(void);
extern double CNF_GetStratumWeight(void);
extern double CNF_GetCombineLimit(void);
-extern int CNF_AllowLocalReference(int *stratum);
+extern int CNF_AllowLocalReference(int *stratum, int *orphan, double *distance);
extern void CNF_SetupAccessRestrictions(void);
diff --git a/configure b/configure
index 144e30d..cb1d139 100755
--- a/configure
+++ b/configure
@@ -111,7 +111,6 @@ Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--datarootdir=DIR data root [PREFIX/share]
- --infodir=DIR info documentation [DATAROOTDIR/info]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/chrony]
--localstatedir=DIR modifiable single-machine data [/var]
@@ -261,9 +260,6 @@ do
--datarootdir=* )
SETDATAROOTDIR=`echo $option | sed -e 's/^.*=//;'`
;;
- --infodir=* )
- SETINFODIR=`echo $option | sed -e 's/^.*=//;'`
- ;;
--mandir=* )
SETMANDIR=`echo $option | sed -e 's/^.*=//;'`
;;
@@ -797,11 +793,6 @@ if [ "x$SETDATAROOTDIR" != "x" ]; then
DATAROOTDIR=$SETDATAROOTDIR
fi
-INFODIR=${DATAROOTDIR}/info
-if [ "x$SETINFODIR" != "x" ]; then
- INFODIR=$SETINFODIR
-fi
-
MANDIR=${DATAROOTDIR}/man
if [ "x$SETMANDIR" != "x" ]; then
MANDIR=$SETMANDIR
@@ -848,7 +839,7 @@ fi
add_def CHRONY_VERSION "\"${CHRONY_VERSION}\""
-for f in Makefile test/unit/Makefile chrony.conf.5 chrony.texi chronyc.1 chronyd.8
+for f in Makefile doc/Makefile test/unit/Makefile
do
echo Creating $f
sed -e "s%@EXTRA_OBJECTS@%${EXTRA_OBJECTS}%;\
@@ -867,7 +858,6 @@ do
s%@SBINDIR@%${SBINDIR}%;\
s%@DOCDIR@%${DOCDIR}%;\
s%@MANDIR@%${MANDIR}%;\
- s%@INFODIR@%${INFODIR}%;\
s%@LOCALSTATEDIR@%${LOCALSTATEDIR}%;\
s%@CHRONYSOCKDIR@%${CHRONYSOCKDIR}%;\
s%@CHRONYVARDIR@%${CHRONYVARDIR}%;\
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644
index 0000000..bd405df
--- /dev/null
+++ b/doc/Makefile.in
@@ -0,0 +1,72 @@
+ADOC = asciidoctor
+ADOC_FLAGS =
+SED = sed
+HTML_TO_TXT = w3m -dump -T text/html
+
+MAN_FILES = chrony.conf.man chronyc.man chronyd.man
+TXT_FILES = faq.txt installation.txt
+HTML_FILES = $(MAN_FILES:%.man=%.html) $(TXT_FILES:%.txt=%.html)
+MAN_IN_FILES = $(MAN_FILES:%.man=%.man.in)
+
+SYSCONFDIR = @SYSCONFDIR@
+BINDIR = @BINDIR@
+SBINDIR = @SBINDIR@
+MANDIR = @MANDIR@
+DOCDIR = @DOCDIR@
+CHRONYSOCKDIR = @CHRONYSOCKDIR@
+CHRONYVARDIR = @CHRONYVARDIR@
+CHRONY_VERSION = @CHRONY_VERSION@
+DEFAULT_USER = @DEFAULT_USER@
+DEFAULT_HWCLOCK_FILE = @DEFAULT_HWCLOCK_FILE@
+
+SED_COMMANDS = "s%\@SYSCONFDIR\@%$(SYSCONFDIR)%g;\
+ s%\@BINDIR\@%$(BINDIR)%g;\
+ s%\@SBINDIR\@%$(SBINDIR)%g;\
+ s%\@CHRONY_VERSION\@%$(CHRONY_VERSION)%g;\
+ s%\@DEFAULT_HWCLOCK_FILE\@%$(DEFAULT_HWCLOCK_FILE)%g;\
+ s%\@DEFAULT_USER\@%$(DEFAULT_USER)%g;\
+ s%\@CHRONYSOCKDIR\@%$(CHRONYSOCKDIR)%g;\
+ s%\@CHRONYVARDIR\@%$(CHRONYVARDIR)%g;"
+
+man: $(MAN_FILES) $(MAN_IN_FILES)
+html: $(HTML_FILES)
+txt: $(TXT_FILES)
+docs: man html
+
+%.html: %.adoc
+ $(ADOC) $(ADOC_FLAGS) -b html -o - $< | $(SED) -e $(SED_COMMANDS) > $@
+
+%.man.in: %.adoc
+ $(ADOC) $(ADOC_FLAGS) -b manpage -o $@ $<
+
+%.man: %.man.in
+ $(SED) -e $(SED_COMMANDS) < $< > $@
+
+%.txt: %.html
+ $(HTML_TO_TXT) < $< > $@
+
+install: $(MAN_FILES)
+ [ -d $(DESTDIR)$(MANDIR)/man1 ] || mkdir -p $(DESTDIR)$(MANDIR)/man1
+ [ -d $(DESTDIR)$(MANDIR)/man5 ] || mkdir -p $(DESTDIR)$(MANDIR)/man5
+ [ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
+ cp chronyc.man $(DESTDIR)$(MANDIR)/man1/chronyc.1
+ chmod 644 $(DESTDIR)$(MANDIR)/man1/chronyc.1
+ cp chronyd.man $(DESTDIR)$(MANDIR)/man8/chronyd.8
+ chmod 644 $(DESTDIR)$(MANDIR)/man8/chronyd.8
+ cp chrony.conf.man $(DESTDIR)$(MANDIR)/man5/chrony.conf.5
+ chmod 644 $(DESTDIR)$(MANDIR)/man5/chrony.conf.5
+
+install-docs: $(HTML_FILES)
+ [ -d $(DESTDIR)$(DOCDIR) ] || mkdir -p $(DESTDIR)$(DOCDIR)
+ for f in $(HTML_FILES); do \
+ cp $$f $(DESTDIR)$(DOCDIR); \
+ chmod 644 $(DESTDIR)$(DOCDIR)/$$f; \
+ done
+
+clean:
+ rm -f $(MAN_FILES) $(TXT_FILES) $(HTML_FILES)
+ rm -f $(MAN_IN_FILES)
+
+distclean:
+ rm -f $(MAN_FILES) $(TXT_FILES) $(HTML_FILES)
+ rm -f Makefile
diff --git a/doc/chrony.conf.adoc b/doc/chrony.conf.adoc
new file mode 100644
index 0000000..5fb68a3
--- /dev/null
+++ b/doc/chrony.conf.adoc
@@ -0,0 +1,2108 @@
+// This file is part of chrony
+//
+// Copyright (C) Richard P. Curnow 1997-2003
+// Copyright (C) Miroslav Lichvar 2009-2016
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of version 2 of the GNU General Public License as
+// published by the Free Software Foundation.
+//
+// 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+= chrony.conf(5)
+:doctype: manpage
+:man manual: Configuration Files
+:man source: chrony @CHRONY_VERSION@
+
+== NAME
+chrony.conf - chronyd configuration file
+
+== SYNOPSIS
+*chrony.conf*
+
+== DESCRIPTION
+
+This file configures the *chronyd* daemon. The compiled-in location is
+_@SYSCONFDIR@/chrony.conf_, but other locations can be specified on the
+*chronyd* command line with the *-f* option.
+
+Each directive in the configuration file is placed on a separate line. The
+following sections describe each of the directives in turn. The directives can
+occur in any order in the file and they are not case-sensitive.
+
+The configuration directives can also be specified directly on the *chronyd*
+command line. In this case each argument is parsed as a new line and the
+configuration file is ignored.
+
+While the number of supported directives is large, only a few of them are
+typically needed. See the <<examples,*EXAMPLES*>> section for configuration in
+typical operating scenarios.
+
+The configuration file might contain comment lines. A comment line is any line
+that starts with zero or more spaces followed by any one of the following
+characters: *!*, *;*, *#*, *%*. Any line with this format will be ignored.
+
+== DIRECTIVES
+
+=== Time sources
+
+[[server]]*server* _hostname_ [_option_]...::
+The *server* directive specifies an NTP server which can be used as a time
+source. The client-server relationship is strictly hierarchical: a client might
+synchronise its system time to that of the server, but the server's system time
+will never be influenced by that of a client.
++
+The *server* directive is immediately followed by either the name of the
+server, or its IP address. The *server* directive supports the following
+options:
++
+*minpoll* _poll_:::
+Although *chronyd* will trim the rate at which it samples the server during
+normal operation, the user might want to constrain the minimum polling interval.
+This is always defined as a power of 2, so *minpoll 5* would mean that the
+polling interval cannot drop below 32 seconds. The default is 6 (64 seconds).
+*maxpoll* _poll_:::
+In a similar way, the user might want to constrain the maximum polling interval.
+Again this is specified as a power of 2, *maxpoll 9* indicates that the polling
+interval must stay at or below 512 seconds. The default is 10 (1024 seconds).
+*iburst*:::
+If this option is set, the interval between the first four polls will be 2
+seconds instead of _minpoll_. This is useful to quickly get the first update of
+the clock after *chronyd* is started.
+*key* _id_:::
+The NTP protocol supports the inclusion of checksums in the packets, to prevent
+computers having their system time upset by rogue packets being sent to them.
+The checksums are generated as a function of a password, using the
+cryptographic hash function set in the key file, which is specified by the
+<<keyfile,*keyfile*>> directive.
++
+If the key option is present, *chronyd* will attempt to use authenticated
+packets when communicating with this server. The key number used will be the
+single argument to the key option (an unsigned integer in the range 1 through
+2^32-1). The server must have the same password for this key number configured,
+otherwise no relationship between the computers will be possible.
+*maxdelay* _delay_:::
+*chronyd* uses the network round-trip delay to the server to determine how
+accurate a particular measurement is likely to be. Long round-trip delays
+indicate that the request, or the response, or both were delayed. If only one
+of the messages was delayed the measurement error is likely to be substantial.
++
+For small variations in the round-trip delay, *chronyd* uses a weighting scheme
+when processing the measurements. However, beyond a certain level of delay the
+measurements are likely to be so corrupted as to be useless. (This is
+particularly so on dial-up or other slow links, where a long delay probably
+indicates a highly asymmetric delay caused by the response waiting behind a lot
+of packets related to a download of some sort).
++
+If the user knows that round trip delays above a certain level should cause the
+measurement to be ignored, this level can be defined with the *maxdelay*
+option. For example, *maxdelay 0.3* would indicate that measurements with a
+round-trip delay of 0.3 seconds or more should be ignored. The default value is
+3 seconds.
+*maxdelayratio* _ratio_:::
+This option is similar to the maxdelay option above. *chronyd* keeps a record
+of the minimum round-trip delay amongst the previous measurements that it has
+buffered. If a measurement has a round trip delay that is greater than the
+maxdelayratio times the minimum delay, it will be rejected.
+*maxdelaydevratio* _ratio_:::
+If a measurement has a ratio of the increase in the round-trip delay from the
+minimum delay amongst the previous measurements to the standard deviation of
+the previous measurements that is greater than the specified ratio, it will be
+rejected. The default is 10.0.
+*minsamples* _samples_:::
+Set the minimum number of samples kept for this source. This overrides the
+<<minsamples,*minsamples*>> directive.
+*maxsamples* _samples_:::
+Set the maximum number of samples kept for this source. This overrides the
+<<maxsamples,*maxsamples*>> directive.
+*offline*:::
+If the server will not be reachable when *chronyd* is started, the *offline*
+option can be specified. *chronyd* will not try to poll the server until it is
+enabled to do so (by using the <<chronyc.adoc#online,*online*>> command in
+*chronyc*).
+*auto_offline*:::
+If this option is set, the server will be assumed to have gone offline when 2
+requests have been sent to it without receiving a response. This option avoids
+the need to run the <<chronyc.adoc#offline,*offline*>> command from *chronyc*
+when disconnecting the network link. (It will still be necessary to use the
+<<chronyc.adoc#online,*online*>> command when the link has been established, to
+enable measurements to start.)
+*prefer*:::
+Prefer this source over sources without prefer option.
+*noselect*:::
+Never select this source. This is particularly useful for monitoring.
+*trust*:::
+Assume time from this source is always true. It can be rejected as a
+falseticker in the source selection only if another source with this option
+does not agree with it.
+*require*:::
+Require that at least one of the sources specified with this option is
+selectable (i.e. recently reachable and not a falseticker) before updating the
+clock. Together with the *trust* option this might be useful to allow a trusted
+authenticated source to be safely combined with unauthenticated sources in
+order to improve the accuracy of the clock. They can be selected and used for
+synchronisation only if they agree with the trusted and required source.
+*polltarget* _target_:::
+Target number of measurements to use for the regression algorithm which
+*chronyd* will try to maintain by adjusting the polling interval between
+*minpoll* and *maxpoll*. A higher target makes *chronyd* prefer shorter polling
+intervals. The default is 6 and a useful range is from 6 to 60.
+*port* _port_:::
+This option allows the UDP port on which the server understands NTP requests to
+be specified. For normal servers this option should not be required (the
+default is 123, the standard NTP port).
+*presend* _poll_:::
+If the timing measurements being made by *chronyd* are the only network data
+passing between two computers, you might find that some measurements are badly
+skewed due to either the client or the server having to do an ARP lookup on the
+other party prior to transmitting a packet. This is more of a problem with long
+sampling intervals, which might be similar in duration to the lifetime of entries
+in the ARP caches of the machines.
++
+In order to avoid this problem, the *presend* option can be used. It takes a
+single integer argument, which is the smallest polling interval for which an
+extra pair of NTP packets will be exchanged between the client and the server
+prior to the actual measurement. For example, with the following option
+included in a *server* directive:
++
+----
+presend 9
+----
++
+when the polling interval is 512 seconds or more, an extra NTP client packet
+will be sent to the server a short time (4 seconds) before making the actual
+measurement.
+*minstratum* _stratum_:::
+When the synchronisation source is selected from available sources, sources
+with lower stratum are normally slightly preferred. This option can be used to
+increase stratum of the source to the specified minimum, so *chronyd* will
+avoid selecting that source. This is useful with low stratum sources that are
+known to be unreliable or inaccurate and which should be used only when other
+sources are unreachable.
+*version* _version_:::
+This option sets the NTP version number used in packets sent to the server.
+This can be useful when the server runs an old NTP implementation that does not
+respond to newer versions. The default version number is 4.
+
+[[pool]]*pool* _name_ [_option_]...::
+The syntax of this directive is similar to that for the <<server,*server*>>
+directive, except that it is used to specify a pool of NTP servers rather than
+a single NTP server. The pool name is expected to resolve to multiple addresses
+which might change over time.
++
+All options valid in the <<server,*server*>> directive can be used in this
+directive too. There is one option specific to the *pool* directive:
+*maxsources* sets the maximum number of sources that can be used from the pool,
+the default value is 4.
++
+On start, when the pool name is resolved, *chronyd* will add up to 16 sources,
+one for each resolved address. When the number of sources from which at least
+one valid reply was received reaches the number specified by the *maxsources*
+option, the other sources will be removed. When a pool source is unreachable,
+marked as a falseticker, or has a distance larger than the limit set by the
+<<maxdistance,*maxdistance*>> directive, *chronyd* will try to replace the
+source with a newly resolved address from the pool.
++
+An example of the *pool* directive is
++
+----
+pool pool.ntp.org iburst maxsources 3
+----
+
+[[peer]]*peer* _hostname_ [_option_]...::
+The syntax of this directive is identical to that for the <<server,*server*>>
+directive, except that it is used to specify an NTP peer rather than an NTP
+server.
++
+When a key is specified by the *key* option to enable authentication, both
+peers must be configured to use the same key and the same key number.
++
+Please note that NTP peers that are not configured with a key to enable
+authentication are vulnerable to a denial-of-service attack. An attacker
+knowing that NTP hosts A and B are peering with each other can send a packet
+with random timestamps to host A with source address of B which will set the
+NTP state variables on A to the values sent by the attacker. Host A will then
+send on its next poll to B a packet with an origin timestamp that does not match
+the transmit timestamp of B and the packet will be dropped. If the attacker
+does this periodically for both hosts, they will not be able to synchronise to
+each other.
++
+This attack can be prevented by enabling authentication with the *key* option,
+or by using the <<server,*server*>> directive on both sides to specify the other
+host as a server instead of a peer. The disadvantage of the *server* directive
+is that it will double the network traffic between the two hosts.
+
+[[initstepslew]]*initstepslew* _step-threshold_ [_hostname_]...::
+In normal operation, *chronyd* slews the time when it needs to adjust the
+system clock. For example, to correct a system clock which is 1 second slow,
+*chronyd* slightly increases the amount by which the system clock is advanced
+on each clock interrupt, until the error is removed. Note that at no time does
+time run backwards with this method.
++
+On most Unix systems it is not desirable to step the system clock, because many
+programs rely on time advancing monotonically forwards.
++
+When the *chronyd* daemon is initially started, it is possible that the system
+clock is considerably in error. Attempting to correct such an error by slewing
+might not be sensible, since it might take several hours to correct the error by
+this means.
++
+The purpose of the *initstepslew* directive is to allow *chronyd* to make a
+rapid measurement of the system clock error at boot time, and to correct the
+system clock by stepping before normal operation begins. Since this would
+normally be performed only at an appropriate point in the system boot sequence,
+no other software should be adversely affected by the step.
++
+If the correction required is less than a specified threshold, a slew is used
+instead. This makes it safer to restart *chronyd* whilst the system is in
+normal operation.
++
+The *initstepslew* directive takes a threshold and a list of NTP servers as
+arguments. Each of the servers is rapidly polled several times, and a majority
+voting mechanism used to find the most likely range of system clock error that
+is present. A step or slew is applied to the system clock to correct this
+error. *chronyd* then enters its normal operating mode.
++
+An example of the use of the directive is:
++
+----
+initstepslew 30 foo.example.net bar.example.net
+----
++
+where 2 NTP servers are used to make the measurement. The _30_ indicates that
+if the system's error is found to be 30 seconds or less, a slew will be used to
+correct it; if the error is above 30 seconds, a step will be used.
++
+The *initstepslew* directive can also be used in an isolated LAN environment,
+where the clocks are set manually. The most stable computer is chosen as the
+master, and the other computers are slaved to it. If each of the slaves is
+configured with the <<local,*local*>> directive, the master can be set up with
+an *initstepslew* directive which references some or all of the slaves. Then,
+if the master machine has to be rebooted, the slaves can be relied on to act
+analogously to a flywheel and preserve the time for a short period while the
+master completes its reboot.
++
+The *initstepslew* directive is functionally similar to a combination of the
+<<makestep,*makestep*>> and <<server,*server*>> directives with the *iburst*
+option. The main difference is that the *initstepslew* servers are used only
+before normal operation begins and that the foreground *chronyd* process waits
+for *initstepslew* to finish before exiting. This is useful to prevent programs
+started in the boot sequence after *chronyd* from reading the clock before it
+has been stepped.
+
+[[refclock]]*refclock* _driver_ _parameter_ [_option_]...::
+The *refclock* directive specifies a hardware reference clock to be used as a
+time source. It has two mandatory parameters, a driver name and a
+driver-specific parameter.
++
+There are currently four drivers included:
++
+*PPS*:::
+Driver for the kernel PPS (pulse per second) API. The parameter is the path to
+the PPS device (typically _/dev/pps?_). The assert events are used for
+synchronisation by default. String *:clear* can be appended to the path to use
+the clear events instead.
++
+As PPS refclocks don't supply full time, *chronyd* needs to be configured with
+another time source (NTP or non-PPS refclock) in order to complete samples from
+the PPS refclock. An alternative is to enable the <<local,*local*>> directive
+to allow synchronisation with some unknown but constant offset.
+For example:
++
+----
+refclock PPS /dev/pps0 lock NMEA
+refclock SHM 0 offset 0.5 delay 0.2 refid NMEA noselect
+----
++
+*SHM*:::
+NTP shared memory driver. This driver uses a shared memory segment to receive
+samples from another process. The parameter is the number of the shared memory
+segment, typically 0, 1, 2 or 3. For example:
++
+----
+refclock SHM 1 poll 3 refid GPS1
+----
++
+A driver option in form of *:perm=NNN* can be appended to the segment number to
+create the segment with permissions other than the default 0600.
++
+Examples of applications that can be used as SHM refclocks are
+http://www.catb.org/gpsd/[*gpsd*],
+http://www.buzzard.me.uk/jonathan/radioclock.html[*radioclk*], and
+https://www.vanheusden.com/time/omnisync/[*omnisync*].
++
+*SOCK*:::
+Unix domain socket driver. It is similar to the SHM driver, but samples are
+received from a Unix domain socket instead of shared memory and the messages
+have a different format. The parameter is the path to the socket, which
+*chronyd* creates on start. An advantage over the SHM driver is that SOCK does
+not require polling and it can receive PPS samples with incomplete time. The
+format of the messages is described in the _refclock_sock.c_ file in the chrony
+source code.
++
+An application which supports the SOCK protocol is the *gpsd* daemon. The path
+where *gpsd* expects the socket to be created is described in the *gpsd(8)* man
+page. For example:
++
+----
+refclock SOCK /var/run/chrony.ttyS0.sock
+----
++
+*PHC*:::
+PTP hardware clock (PHC) driver. The parameter is the path to the device of
+the PTP clock, which for example can be synchronised by *ptp4l* from
+http://linuxptp.sourceforge.net[*linuxptp*]. PTP clocks are typically kept in
+TAI instead of UTC, so the *offset* option should be used to compensate for the
+current UTC-TAI offset. For example:
++
+----
+refclock PHC /dev/ptp0 poll 3 dpoll -2 offset -36
+----
++
+::
+The *refclock* directive also supports a number of options:
++
+*poll* _poll_:::
+Timestamps produced by refclock drivers are not used immediately, but they are
+stored and processed by a median filter in the polling interval specified by
+this option. This is defined as a power of 2 and can be negative to specify a
+sub-second interval. The default is 4 (16 seconds). A shorter interval allows
+*chronyd* to react faster to changes in the frequency of the system clock, but
+it might have a negative effect on its accuracy if the samples have a lot of
+jitter.
+*dpoll* _dpoll_:::
+Some drivers do not listen for external events and try to produce samples in
+their own polling interval. This is defined as a power of 2 and can be negative
+to specify a sub-second interval. The default is 0 (1 second).
+*refid* _refid_:::
+This option is used to specify the reference ID of the refclock, as up to four
+ASCII characters. The default reference ID is composed from the first three
+characters of the driver name and the number of the refclock. Each refclock
+must have a unique reference ID.
+*lock* _refid_:::
+This option can be used to lock a PPS refclock to another refclock, which is
+specified by its reference ID. In this mode received PPS samples are paired
+directly with raw samples from the specified refclock.
+*rate* _rate_:::
+This option sets the rate of the pulses in the PPS signal (in Hz). This option
+controls how the pulses will be completed with real time. To actually receive
+more than one pulse per second, a negative *dpoll* has to be specified (-3 for
+a 5Hz signal). The default is 1.
+*offset* _offset_:::
+This option can be used to compensate for a constant error. The specified
+offset (in seconds) is applied to all samples produced by the reference clock.
+The default is 0.0.
+*delay* _delay_:::
+This option sets the NTP delay of the source (in seconds). Half of this value
+is included in the maximum assumed error which is used in the source selection
+algorithm. Increasing the delay is useful to avoid having no majority in the
+source selection or to make it prefer other sources. The default is 1e-9 (1
+nanosecond).
+*precision* _precision_:::
+This option sets the refclock precision (in seconds). The default is 1e-6 (1
+microsecond) for SHM refclock, and 1e-9 (1 nanosecond) for SOCK, PPS and PHC
+refclocks.
+*maxdispersion* _dispersion_:::
+Maximum allowed dispersion for filtered samples (in seconds). Samples with
+larger estimated dispersion are ignored. By default, this limit is disabled.
+*filter* _samples_:::
+This option sets the length of the median filter which is used to reduce the
+noise in the measurements. With each poll about 40 percent of the stored
+samples are discarded and one final sample is calculated as an average of the
+remaining samples. If the length is 4 or more, at least 4 samples have to be
+collected between polls. For lengths below 4, the filter has to be full. The
+default is 64.
+*prefer*:::
+Prefer this source over sources without the prefer option.
+*noselect*:::
+Never select this source. This is useful for monitoring or with sources which
+are not very accurate, but are locked with a PPS refclock.
+*trust*:::
+Assume time from this source is always true. It can be rejected as a
+falseticker in the source selection only if another source with this option
+does not agree with it.
+*require*:::
+Require that at least one of the sources specified with this option is
+selectable (i.e. recently reachable and not a falseticker) before updating the
+clock. Together with the *trust* option this can be useful to allow a trusted,
+but not very precise, reference clock to be safely combined with
+unauthenticated NTP sources in order to improve the accuracy of the clock. They
+can be selected and used for synchronisation only if they agree with the
+trusted and required source.
+*minsamples* _samples_:::
+Set the minimum number of samples kept for this source. This overrides the
+<<minsamples,*minsamples*>> directive.
+*maxsamples* _samples_:::
+Set the maximum number of samples kept for this source. This overrides the
+<<maxsamples,*maxsamples*>> directive.
+
+[[manual]]*manual*::
+The *manual* directive enables support at run-time for the
+<<chronyc.adoc#settime,*settime*>> command in *chronyc*. If no *manual*
+directive is included, any attempt to use the *settime* command in *chronyc*
+will be met with an error message.
++
+Note that the *settime* command can be enabled at run-time using
+the <<chronyc.adoc#manual,*manual*>> command in *chronyc*. (The idea of the two
+commands is that the *manual* command controls the manual clock driver's
+behaviour, whereas the *settime* command allows samples of manually entered
+time to be provided.)
+
+[[acquisitionport]]*acquisitionport* _port_::
+By default, *chronyd* uses a separate client socket for each configured server
+and their source port is chosen arbitrarily by the operating system. However,
+you can use the *acquisitionport* directive to explicitly specify a port and
+use only one socket (per IPv4 or IPv6 address family) for all configured servers.
+This can be useful for getting through some firewalls. If set to 0, the source
+port of the socket will be chosen arbitrarily.
++
+It can be set to the same port as is used by the NTP server (which can be
+configured with the <<port,*port*>> directive) to use only one socket for all
+NTP packets.
++
+An example of the *acquisitionport* directive is:
++
+----
+acquisitionport 1123
+----
++
+This would change the source port used for client requests to UDP port 1123.
+You could then persuade the firewall administrator to open that port.
+
+[[bindacqaddress]]*bindacqaddress* _address_::
+The *bindacqaddress* directive sets the network interface to which
+*chronyd* will bind its NTP client sockets. The syntax is similar to the
+<<bindaddress,*bindaddress*>> and <<bindcmdaddress,*bindcmdaddress*>>
+directives.
++
+For each of the IPv4 and IPv6 protocols, only one *bindacqaddress* directive
+can be specified.
+
+[[dumpdir]]*dumpdir* _directory_::
+To compute the rate of gain or loss of time, *chronyd* has to store a
+measurement history for each of the time sources it uses.
++
+Certain systems (Linux, FreeBSD, NetBSD, Solaris) have operating system support
+for setting the rate of gain or loss to compensate for known errors. (On Mac OS
+X, *chronyd* must simulate such a capability by periodically slewing the system
+clock forwards or backwards by a suitable amount to compensate for the error
+built up since the previous slew.)
++
+For such systems, it is possible to save the measurement history across
+restarts of *chronyd* (assuming no changes are made to the system clock
+behaviour whilst it is not running). If this capability is to be used (via the
+*dumponexit* directive in the configuration file, or the
+<<chronyc.adoc#dump,*dump*>> command in *chronyc*), the *dumpdir* directive
+should be used to define the directory where the measurement histories are
+saved.
++
+An example of the directive is:
++
+----
+dumpdir @CHRONYVARDIR@
+----
++
+A source whose reference ID (the IP address for IPv4 sources) is _1.2.3.4_
+would have its measurement history saved in the file
+_/var/lib/chrony/1.2.3.4.dat_.
+
+[[dumponexit]]*dumponexit*::
+If this directive is present, it indicates that *chronyd* should save the
+measurement history for each of its time sources recorded whenever the program
+exits. (See the <<dumpdir,*dumpdir*>> directive above.)
+
+[[maxsamples]]*maxsamples* _samples_::
+The *maxsamples* directive sets the default maximum number of samples that
+*chronyd* should keep for each source. This setting can be overridden for
+individual sources in the <<server,*server*>> and <<refclock,*refclock*>>
+directives. The default value is 0, which disables the configurable limit. The
+useful range is 4 to 64.
+
+[[minsamples]]*minsamples* _samples_::
+The *minsamples* directive sets the default minimum number of samples that
+*chronyd* should keep for each source. This setting can be overridden for
+individual sources in the <<server,*server*>> and <<refclock,*refclock*>>
+directives. The default value is 0. The useful range is 4 to 64.
+
+=== Source selection
+
+[[combinelimit]]*combinelimit* _limit_::
+When *chronyd* has multiple sources available for synchronisation, it has to
+select one source as the synchronisation source. The measured offsets and
+frequencies of the system clock relative to the other sources, however, can be
+combined with the selected source to improve the accuracy of the system clock.
++
+The *combinelimit* directive limits which sources are included in the combining
+algorithm. Their synchronisation distance has to be shorter than the distance
+of the selected source multiplied by the value of the limit. Also, their
+measured frequencies have to be close to the frequency of the selected source.
++
+By default, the limit is 3. Setting the limit to 0 effectively disables the
+source combining algorithm and only the selected source will be used to control
+the system clock.
+
+[[maxdistance]]*maxdistance* _distance_::
+The *maxdistance* directive sets the maximum allowed root distance of the
+sources to not be rejected by the source selection algorithm. The distance
+includes the accumulated dispersion, which might be large when the source is no
+longer synchronised, and half of the total round-trip delay to the primary
+source.
++
+By default, the maximum root distance is 3 seconds.
++
+Setting *maxdistance* to a larger value can be useful to allow synchronisation
+with a server that only has a very infrequent connection to its sources and can
+accumulate a large dispersion between updates of its clock.
+
+[[minsources]]*minsources* _sources_::
+The *minsources* directive sets the minimum number of sources that need to be
+considered as selectable in the source selection algorithm before the local
+clock is updated. The default value is 1.
++
+Setting this option to a larger number can be used to improve the reliability.
+More sources will have to agree with each other and the clock will not be
+updated when only one source (which could be serving incorrect time) is
+reachable.
+
+[[reselectdist]]*reselectdist* _distance_::
+When *chronyd* selects a synchronisation source from available sources, it
+will prefer the one with the shortest synchronisation distance. However, to
+avoid frequent reselecting when there are sources with similar distance, a
+fixed distance is added to the distance for sources that are currently not
+selected. This can be set with the *reselectdist* directive. By default, the
+distance is 100 microseconds.
+
+[[stratumweight]]*stratumweight* _distance_::
+The *stratumweight* directive sets how much distance should be added per
+stratum to the synchronisation distance when *chronyd* selects the
+synchronisation source from available sources.
++
+By default, the weight is 0.001 seconds. This means that the stratum of the sources
+in the selection process matters only when the differences between the
+distances are in milliseconds.
+
+=== System clock
+
+[[corrtimeratio]]*corrtimeratio* _ratio_::
+When *chronyd* is slewing the system clock to correct an offset, the rate at
+which it is slewing adds to the frequency error of the clock. On Linux,
+FreeBSD, NetBSD and Solaris this rate can be controlled.
++
+The *corrtimeratio* directive sets the ratio between the duration in which the
+clock is slewed for an average correction according to the source history and
+the interval in which the corrections are done (usually the NTP polling
+interval). Corrections larger than the average take less time and smaller
+corrections take more time, the amount of the correction and the correction
+time are inversely proportional.
++
+Increasing *corrtimeratio* improves the overall frequency error of the system
+clock, but increases the overall time error as the corrections take longer.
++
+By default, the ratio is set to 3, the time accuracy of the clock is preferred
+over its frequency accuracy.
++
+The maximum allowed slew rate can be set by the <<maxslewrate,*maxslewrate*>>
+directive. The current remaining correction is shown in the
+<<chronyc.adoc#tracking,*tracking*>> report as the *System time* value.
+
+[[driftfile]]*driftfile* _file_::
+One of the main activities of the *chronyd* program is to work out the rate at
+which the system clock gains or loses time relative to real time.
++
+Whenever *chronyd* computes a new value of the gain or loss rate, it is desirable
+to record it somewhere. This allows *chronyd* to begin compensating the system
+clock at that rate whenever it is restarted, even before it has had a chance to
+obtain an equally good estimate of the rate during the new run. (This process
+can take many minutes, at least.)
++
+The *driftfile* directive allows a file to be specified into which *chronyd*
+can store the rate information. Two parameters are recorded in the file. The
+first is the rate at which the system clock gains or loses time, expressed in
+parts per million, with gains positive. Therefore, a value of 100.0 indicates
+that when the system clock has advanced by a second, it has gained 100
+microseconds in reality (so the true time has only advanced by 999900
+microseconds). The second is an estimate of the error bound around the first
+value in which the true rate actually lies.
++
+An example of the driftfile directive is:
++
+----
+driftfile @CHRONYVARDIR@/drift
+----
+
+[[fallbackdrift]]*fallbackdrift* _min-interval_ _max-interval_::
+Fallback drifts are long-term averages of the system clock drift calculated
+over exponentially increasing intervals. They are used when the clock is no
+longer synchronised to avoid quickly drifting away from true time if there was
+a short-term deviation in the drift before the synchronisation was lost.
++
+The directive specifies the minimum and maximum interval since the last clock
+update to switch between fallback drifts. They are defined as a power of 2 (in
+seconds). The syntax is as follows:
++
+----
+fallbackdrift 16 19
+----
++
+In this example, the minimum interval is 16 (18 hours) and the maximum interval is
+19 (6 days). The system clock frequency will be set to the first fallback 18
+hours after last clock update, to the second after 36 hours, etc. This might be
+a good setting to cover daily and weekly temperature fluctuations.
++
+By default (or if the specified maximum or minimum is 0), no fallbacks are used
+and the clock frequency changes only with new measurements from NTP sources,
+reference clocks, or manual input.
+
+[[leapsecmode]]*leapsecmode* _mode_::
+A leap second is an adjustment that is occasionally applied to UTC to keep it
+close to the mean solar time. When a leap second is inserted, the last day of
+June or December has an extra second 23:59:60.
++
+For computer clocks that is a problem. The Unix time is defined as number of
+seconds since 00:00:00 UTC on 1 January 1970 without leap seconds. The system
+clock cannot have time 23:59:60, every minute has 60 seconds and every day has
+86400 seconds by definition. The inserted leap second is skipped and the clock
+is suddenly ahead of UTC by one second. The *leapsecmode* directive selects how
+that error is corrected. There are four options:
++
+*system*:::
+When inserting a leap second, the kernel steps the system clock backwards by
+one second when the clock gets to 00:00:00 UTC. When deleting a leap second, it
+steps forward by one second when the clock gets to 23:59:59 UTC. This is the
+default mode when the system driver supports leap seconds (i.e. on Linux,
+FreeBSD, NetBSD and Solaris).
+*step*:::
+This is similar to the *system* mode, except the clock is stepped by
+*chronyd* instead of the kernel. It can be useful to avoid bugs in the kernel
+code that would be executed in the *system* mode. This is the default mode
+when the system driver does not support leap seconds.
+*slew*:::
+The clock is corrected by slewing started at 00:00:00 UTC when a leap second
+is inserted or 23:59:59 UTC when a leap second is deleted. This might be
+preferred over the *system* and *step* modes when applications running on the
+system are sensitive to jumps in the system time and it is acceptable that the
+clock will be off for a longer time. On Linux with the default
+<<maxslewrate,*maxslewrate*>> value the correction takes 12 seconds.
+*ignore*:::
+No correction is applied to the clock for the leap second. The clock will be
+corrected later in normal operation when new measurements are made and the
+estimated offset includes the one second error.
+::
++
+When serving time to NTP clients that cannot be configured to correct their
+clocks for a leap second by slewing, or to clients that would correct at
+slightly different rates when it is necessary to keep them close together, the
+*slew* mode can be combined with the <<smoothtime,*smoothtime*>> directive to
+enable a server leap smear.
++
+When smearing a leap second, the leap status is suppressed on the server and
+the served time is corrected slowly be slewing instead of stepping. The clients
+do not need any special configuration as they do not know there is any leap
+second and they follow the server time which eventually brings them back to
+UTC. Care must be taken to ensure they use only NTP servers which smear the
+leap second in exactly the same way for synchronisation.
++
+This feature must be used carefully, because the server is intentionally not
+serving its best estimate of the true time.
++
+A recommended configuration to enable a server leap smear is:
++
+----
+leapsecmode slew
+maxslewrate 1000
+smoothtime 400 0.001 leaponly
+----
++
+The first directive is necessary to disable the clock step which would reset
+the smoothing process. The second directive limits the slewing rate of the
+local clock to 1000 ppm, which improves the stability of the smoothing process
+when the local correction starts and ends. The third directive enables the
+server time smoothing process. It will start when the clock gets to 00:00:00
+UTC and it will take 17 hours 34 minutes to finish. The frequency offset will
+be changing by 0.001 ppm per second and will reach a maximum of 31.623 ppm. The
+*leaponly* option makes the duration of the leap smear constant and allows the
+clients to safely synchronise with multiple identically configured leap
+smearing servers.
+
+[[leapsectz]]*leapsectz* _timezone_::
+This directive is used to set the name of the timezone in the system tz
+database which *chronyd* can use to find out when will the next leap second
+occur. It will periodically check if the times 23:59:59 and 23:59:60 are valid
+on Jun 30 and Dec 31 in the timezone. This typically works with the *right/UTC*
+timezone.
++
+This directive is mainly useful with reference clocks which do not provide
+leap second information. It is not necessary to restart *chronyd* if the tz
+database is updated with a new leap second at least 12 hours before the event.
++
+An example of the directive is:
++
+----
+leapsectz right/UTC
+----
++
+The following shell command verifies that the timezone contains leap seconds
+and can be used with this directive:
++
+----
+$ TZ=right/UTC date -d 'Dec 31 2008 23:59:60'
+Wed Dec 31 23:59:60 UTC 2008
+----
+
+[[makestep]]*makestep* _threshold_ _limit_::
+Normally *chronyd* will cause the system to gradually correct any time offset,
+by slowing down or speeding up the clock as required. In certain situations,
+the system clock might be so far adrift that this slewing process would take a
+very long time to correct the system clock.
++
+This directive forces *chronyd* to step the system clock if the adjustment is
+larger than a threshold value, but only if there were no more clock updates
+since *chronyd* was started than a specified limit (a negative value can be
+used to disable the limit).
++
+This is particularly useful when using reference clocks, because the
+<<initstepslew,*initstepslew*>> directive works only with NTP sources.
++
+An example of the use of this directive is:
++
+----
+makestep 0.1 3
+----
++
+This would step the system clock if the adjustment is larger than 0.1 seconds, but
+only in the first three clock updates.
+
+[[maxchange]]*maxchange* _offset_ _start_ _ignore_::
+This directive sets the maximum allowed offset corrected on a clock update. The
+check is performed only after the specified number of updates to allow a large
+initial adjustment of the system clock. When an offset larger than the
+specified maximum occurs, it will be ignored for the specified number of times
+and then *chronyd* will give up and exit (a negative value can be used to never
+exit). In both cases a message is sent to syslog.
++
+An example of the use of this directive is:
++
+----
+maxchange 1000 1 2
+----
++
+After the first clock update, *chronyd* will check the offset on every clock
+update, it will ignore two adjustments larger than 1000 seconds and exit on
+another one.
+
+[[maxclockerror]]*maxclockerror* _error-in-ppm_::
+The *maxclockerror* directive sets the maximum assumed frequency error that the
+system clock can gain on its own between clock updates. It describes the
+stability of the clock.
++
+By default, the maximum error is 1 ppm.
++
+Typical values for _error-in-ppm_ might be 10 for a low quality clock and 0.1
+for a high quality clock using a temperature compensated crystal oscillator.
+
+[[maxdrift]]*maxdrift* _drift-in-ppm_::
+This directive specifies the maximum assumed drift (frequency error) of the
+system clock. It limits the frequency adjustment that *chronyd* is allowed to
+use to correct the measured drift. It is an additional limit to the maximum
+adjustment that can be set by the system driver (100000 ppm on Linux, 500 ppm
+on FreeBSD and NetBSD, 32500 ppm on Solaris).
++
+By default, the maximum assumed drift is 500000 ppm, i.e. the adjustment is
+limited by the system driver rather than this directive.
+
+[[maxupdateskew]]*maxupdateskew* _skew-in-ppm_::
+One of *chronyd*'s tasks is to work out how fast or slow the computer's clock
+runs relative to its reference sources. In addition, it computes an estimate of
+the error bounds around the estimated value.
++
+If the range of error is too large, it probably indicates that the measurements
+have not settled down yet, and that the estimated gain or loss rate is not very
+reliable.
++
+The *maxupdateskew* directive sets the threshold for determining whether an
+estimate might be so unreliable that it should not be used. By default, the
+threshold is 1000 ppm.
++
+Typical values for _skew-in-ppm_ might be 100 for a dial-up connection to
+servers over a phone line, and 5 or 10 for a computer on a LAN.
++
+It should be noted that this is not the only means of protection against using
+unreliable estimates. At all times, *chronyd* keeps track of both the estimated
+gain or loss rate, and the error bound on the estimate. When a new estimate is
+generated following another measurement from one of the sources, a weighted
+combination algorithm is used to update the master estimate. So if *chronyd*
+has an existing highly-reliable master estimate and a new estimate is generated
+which has large error bounds, the existing master estimate will dominate in the
+new master estimate.
+
+[[maxslewrate]]*maxslewrate* _rate-in-ppm_::
+The *maxslewrate* directive sets the maximum rate at which *chronyd* is allowed
+to slew the time. It limits the slew rate controlled by the correction time
+ratio (which can be set by the <<corrtimeratio,*corrtimeratio*>> directive) and
+is effective only on systems where *chronyd* is able to control the rate (i.e.
+Linux, FreeBSD, NetBSD, Solaris).
++
+For each system there is a maximum frequency offset of the clock that
+can be set by the driver. On Linux it is 100000 ppm, on FreeBSD and NetBSD
+it is 5000 ppm, and on Solaris it is 32500 ppm. Also, due to a kernel
+limitation, setting *maxslewrate* on FreeBSD and NetBSD to a value between 500
+ppm and 5000 ppm will effectively set it to 500 ppm.
++
+By default, the maximum slew rate is set to 83333.333 ppm (one twelfth).
+
+[[tempcomp]]
+*tempcomp* _file_ _interval_ _T0_ _k0_ _k1_ _k2_::
+*tempcomp* _file_ _interval_ _points-file_::
+Normally, changes in the rate of drift of the system clock are caused mainly by
+changes in the temperature of the crystal oscillator on the motherboard.
++
+If there are temperature measurements available from a sensor close to the
+oscillator, the *tempcomp* directive can be used to compensate for the changes
+in the temperature and improve the stability and accuracy of the clock.
++
+The result depends on many factors, including the resolution of the sensor, the
+amount of noise in the measurements, the polling interval of the time source,
+the compensation update interval, how well the compensation is specified, and
+how close the sensor is to the oscillator. When it is working well, the
+frequency reported in the _tracking.log_ file is more stable and the maximum
+reached offset is smaller.
++
+There are two forms of the directive. The first one has six parameters: a path
+to the file containing the current temperature from the sensor (in text
+format), the compensation update interval (in seconds), and temperature
+coefficients _T0_, _k0_, _k1_, _k2_.
++
+The frequency compensation is calculated (in ppm) as
++
+----
+k0 + (T - T0) * k1 + (T - T0)^2 * k2
+----
++
+The result has to be between -10 ppm and 10 ppm, otherwise the measurement is
+considered invalid and will be ignored. The _k0_ coefficient can be adjusted to
+keep the compensation in that range.
++
+An example of the use is:
++
+----
+tempcomp /sys/class/hwmon/hwmon0/temp2_input 30 26000 0.0 0.000183 0.0
+----
++
+The measured temperature will be read from the file in the Linux sysfs
+filesystem every 30 seconds. When the temperature is 26000 (26 degrees
+Celsius), the frequency correction will be zero. When it is 27000 (27 degrees
+Celsius), the clock will be set to run faster by 0.183 ppm, etc.
++
+The second form has three parameters: the path to the sensor file, the update
+interval, and a path to a file containing a list of (temperature, compensation)
+points, from which the compensation is linearly interpolated or extrapolated.
++
+An example is:
++
+----
+tempcomp /sys/class/hwmon/hwmon0/temp2_input 30 /etc/chrony.tempcomp
+----
++
+where the _/etc/chrony.tempcomp_ file could have
++
+----
+20000 1.0
+21000 0.64
+22000 0.36
+23000 0.16
+24000 0.04
+25000 0.0
+26000 0.04
+27000 0.16
+28000 0.36
+29000 0.64
+30000 1.0
+----
++
+Valid measurements with corresponding compensations are logged to the
+_tempcomp.log_ file if enabled by the <<log,*log tempcomp*>> directive.
+
+=== NTP server
+
+[[allow]]*allow* [*all*] [_subnet_]::
+The *allow* directive is used to designate a particular subnet from which NTP
+clients are allowed to access the computer as an NTP server.
++
+The default is that no clients are allowed access, i.e. *chronyd* operates
+purely as an NTP client. If the *allow* directive is used, *chronyd* will be
+both a client of its servers, and a server to other clients.
++
+Examples of the use of the directive are as follows:
++
+----
+allow foo.example.net
+allow 1.2
+allow 3.4.5
+allow 6.7.8/22
+allow 6.7.8.9/22
+allow 2001:db8::/32
+allow 0/0
+allow ::/0
+allow
+----
++
+The first directive allows the named node to be an NTP client of this computer.
+The second directive allows any node with an IPv4 address of the form _1.2.x.y_
+(with _x_ and _y_ arbitrary) to be an NTP client of this computer. Likewise,
+the third directive allows any node with an IPv4 address of the form _3.4.5.x_
+to have client NTP access. The fourth and fifth forms allow access from any
+node with an IPv4 address of the form _6.7.8.x_, _6.7.9.x_, _6.7.10.x_ or
+_6.7.11.x_ (with _x_ arbitrary), i.e. the value 22 is the number of bits
+defining the specified subnet. In the fifth form, the final byte is ignored.
+The sixth form is used for IPv6 addresses. The seventh and eighth forms allow
+access by any IPv4 and IPv6 node respectively. The ninth forms allows access by
+any node (IPv4 or IPv6).
++
+A second form of the directive, *allow all*, has a greater effect, depending on
+the ordering of directives in the configuration file. To illustrate the effect,
+consider the two examples:
++
+----
+allow 1.2.3.4
+deny 1.2.3
+allow 1.2
+----
++
+and
++
+----
+allow 1.2.3.4
+deny 1.2.3
+allow all 1.2
+----
++
+In the first example, the effect is the same regardless of what order the three
+directives are given in. So the _1.2.x.y_ subnet is allowed access, except for
+the _1.2.3.x_ subnet, which is denied access, however the host _1.2.3.4_ is
+allowed access.
++
+In the second example, the *allow all 1.2* directives overrides the effect of
+_any_ previous directive relating to a subnet within the specified subnet.
+Within a configuration file this capability is probably rather moot; however,
+it is of greater use for reconfiguration at run-time via *chronyc* with the
+<<chronyc.adoc#allow,*allow all*>> command.
++
+Note, if the <<initstepslew,*initstepslew*>> directive is used in the
+configuration file, each of the computers listed in that directive must allow
+client access by this computer for it to work.
+
+[[deny]]*deny* [*all*] [_subnet_]::
+This is similar to the <<allow,*allow*>> directive, except that it denies NTP
+client access to a particular subnet or host, rather than allowing it.
++
+The syntax is identical.
++
+There is also a *deny all* directive with similar behaviour to the *allow all*
+directive.
+
+[[bindaddress]]*bindaddress* _address_::
+The *bindaddress* directive allows you to restrict the network interface to
+which *chronyd* will listen for NTP requests. This provides an additional level
+of access restriction above that available through the <<deny,*deny*>>
+mechanism.
++
+Suppose you have a local network with addresses in the _192.168.1.0_
+subnet together with an Internet connection. The network interface's IP
+address is _192.168.1.1_. Suppose you want to block all access through the
+Internet connection. You could add the line:
++
+----
+bindaddress 192.168.1.1
+----
++
+to the configuration file.
++
+For each of the IPv4 and IPv6 protocols, only one *bindaddress* directive can be
+specified. Therefore, it is not useful on computers which should serve NTP on
+multiple network interfaces.
+
+[[broadcast]]*broadcast* _interval_ _address_ [_port_]::
+The *broadcast* directive is used to declare a broadcast address to which
+chronyd should send packets in the NTP broadcast mode (i.e. make *chronyd* act
+as a broadcast server). Broadcast clients on that subnet will be able to
+synchronise.
++
+The syntax is as follows:
++
+----
+broadcast 30 192.168.1.255
+broadcast 60 192.168.2.255 12123
+broadcast 60 ff02::101
+----
++
+In the first example, the destination port defaults to UDP port 123 (the normal NTP
+port). In the second example, the destination port is specified as 12123. The
+first parameter in each case (30 or 60 respectively) is the interval in seconds
+between broadcast packets being sent. The second parameter in each case is the
+broadcast address to send the packet to. This should correspond to the
+broadcast address of one of the network interfaces on the computer where
+*chronyd* is running.
++
+You can have more than 1 *broadcast* directive if you have more than 1 network
+interface onto which you want to send NTP broadcast packets.
++
+*chronyd* itself cannot act as a broadcast client; it must always be configured
+as a point-to-point client by defining specific NTP servers and peers. This
+broadcast server feature is intended for providing a time source to other NTP
+implementations.
++
+If *ntpd* is used as the broadcast client, it will try to measure the
+round-trip delay between the server and client with normal client mode packets.
+Thus, the broadcast subnet should also be the subject of an <<allow,*allow*>>
+directive.
+
+[[clientloglimit]]*clientloglimit* _limit_::
+This directive specifies the maximum amount of memory that *chronyd* is allowed
+to allocate for logging of client accesses. The default limit is 524288 bytes,
+which allows monitoring of several thousands of addresses at the same time.
++
+In older *chrony* versions if the limit was set to 0, the memory allocation was
+unlimited.
++
+An example of the use of this directive is:
++
+----
+clientloglimit 1048576
+----
+
+[[noclientlog]]*noclientlog*::
+This directive, which takes no arguments, specifies that client accesses are
+not to be logged. Normally they are logged, allowing statistics to be reported
+using the <<chronyc.adoc#clients,*clients*>> command in *chronyc*.
+
+[[local]]*local* [_option_]...::
+The *local* directive enables a local reference mode, which allows *chronyd*
+operating as an NTP server to appear synchronised to real time (from the
+viewpoint of clients polling it), even when it was never synchronised or
+the last update of the clock happened a long time ago.
++
+This directive is normally used in an isolated network, where computers are
+required to be synchronised to one another, but not necessarily to real time.
+The server can be kept vaguely in line with real time by manual input.
++
+The *local* directive has the following options:
++
+*stratum* _stratum_:::
+This option sets the stratum of the server which will be reported to clients
+when the local reference is active. The specified value is in the range 1
+through 15, and the default value is 10. It should be larger than the maximum
+expected stratum in the network when external NTP servers are accessible.
++
+Stratum 1 indicates a computer that has a true real-time reference directly
+connected to it (e.g. GPS, atomic clock, etc.), such computers are expected to
+be very close to real time. Stratum 2 computers are those which have a stratum
+1 server; stratum 3 computers have a stratum 2 server and so on. A value
+of 10 indicates that the clock is so many hops away from a reference clock that
+its time is fairly unreliable.
+*distance* _distance_:::
+This option sets the threshold for the root distance which will activate the local
+reference. If *chronyd* was synchronised to some source, the local reference
+will not be activated until its root distance reaches the specified value (the
+rate at which the distance is increasing depends on how well the clock was
+tracking the source). The default value is 1 second.
++
+The current root distance can be calculated from root delay and root dispersion
+(reported by the <<chronyc.adoc#tracking,*tracking*>> command in *chronyc*) as:
++
+----
+distance = delay / 2 + dispersion
+----
+*orphan*:::
+This option enables a special '`orphan`' mode, where sources with stratum equal
+to the local _stratum_ are assumed to not serve real time. They are ignored
+unless no other source is selectable and their reference IDs are smaller than
+the local reference ID.
++
+This allows multiple servers in the network to use the same *local*
+configuration and to be synchronised to one another, without confusing clients
+that poll more than one server. Each server needs to be configured to poll all
+other servers with the *local* directive. This ensures only the server with the
+smallest reference ID has the local reference active and others are
+synchronised to it. When that server fails, another will take over.
++
+The *orphan* mode is compatible with the *ntpd*'s orphan mode (enabled by the
+*tos orphan* command).
+::
++
+An example of the directive is:
++
+----
+local stratum 10 orphan
+----
+
+[[port]]*port* _port_::
+This option allows you to configure the port on which *chronyd* will listen for
+NTP requests. The port will be open only when an address is allowed by the
+<<allow,*allow*>> directive or the <<chronyc.adoc#allow,*allow*>> command in
+*chronyc*, an NTP peer is configured, or the broadcast server mode is enabled.
++
+The default value is 123, the standard NTP port. If set to 0, *chronyd* will
+never open the server port and will operate strictly in a client-only mode. The
+source port used in NTP client requests can be set by the
+<<acquisitionport,*acquisitionport*>> directive.
+
+[[ratelimit]]*ratelimit* [_option_]...::
+This directive enables response rate limiting for NTP packets. Its purpose is
+to reduce network traffic with misconfigured or broken NTP clients that are
+polling the server too frequently. The limits are applied to individual IP
+addresses. If multiple clients share one IP address (e.g. multiple hosts behind
+NAT), the sum of their traffic will be limited. If a client that increases its
+polling rate when it does not receive a reply is detected, its rate limiting
+will be temporarily suspended to avoid increasing the overall amount of
+traffic. The maximum number of IP addresses which can be monitored at the same
+time depends on the memory limit set by the <<clientloglimit,*clientloglimit*>>
+directive.
++
+The *ratelimit* directive supports a number of options (which can be defined
+in any order):
++
+*interval*:::
+This option sets the minimum interval between responses. It is defined as a
+power of 2 in seconds. The default value is 3 (8 seconds). The minimum value
+is -4 and the maximum value is 12.
+*burst*:::
+This option sets the maximum number of responses that can be sent in a burst,
+temporarily exceeding the limit specified by the *interval* option. This is
+useful for clients that make rapid measurements on start (e.g. *chronyd* with
+the *iburst* option). The default value is 8. The minimum value is 1 and the
+maximum value is 255.
+*leak*:::
+This option sets the rate at which responses are randomly allowed even if the
+limits specified by the *interval* and *burst* options are exceeded. This is
+necessary to prevent an attacker who is sending requests with a spoofed
+source address from completely blocking responses to that address. The leak
+rate is defined as a power of 1/2 and it is 3 by default, i.e. on average at
+least every eighth request has a response. The minimum value is 1 and the
+maximum value is 4.
+::
++
+An example use of the directive is:
++
+----
+ratelimit interval 4 burst 4
+----
++
+This would reduce the response rate for IP addresses that send packets on
+average more frequently than once per 16 seconds or send packets in bursts
+of more than 4 packets.
+
+[[smoothtime]]*smoothtime* _max-freq_ _max-wander_ [*leaponly*]::
+The *smoothtime* directive can be used to enable smoothing of the time that
+*chronyd* serves to its clients to make it easier for them to track it and keep
+their clocks close together even when large offset or frequency corrections are
+applied to the server's clock, for example after being offline for a longer
+time.
++
+BE WARNED: The server is intentionally not serving its best estimate of the
+true time. If a large offset has been accumulated, it can take a very long time
+to smooth it out. This directive should be used only when the clients are not
+configured to also poll another NTP server, because they could reject this
+server as a falseticker or fail to select a source completely.
++
+The smoothing process is implemented with a quadratic spline function with two
+or three pieces. It is independent from any slewing applied to the local system
+clock, but the accumulated offset and frequency will be reset when the clock is
+corrected by stepping, e.g. by the <<makestep,*makestep*>> directive or the
+<<chronyc.adoc#makestep,*makestep*>> command in *chronyc*. The process can be
+reset without stepping the clock by the <<chronyc.adoc#smoothtime,*smoothtime
+reset*>> command.
++
+The first two arguments of the directive are the maximum frequency offset of
+the smoothed time to the tracked NTP time (in ppm) and the maximum rate at
+which the frequency offset is allowed to change (in ppm per second). *leaponly*
+is an optional third argument which enables a mode where only leap seconds are
+smoothed out and normal offset and frequency changes are ignored. The *leaponly*
+option is useful in a combination with the <<leapsecmode,*leapsecmode slew*>>
+directive to allow the clients to use multiple time smoothing servers safely.
++
+The smoothing process is activated automatically when 1/10000 of the estimated
+skew of the local clock falls below the maximum rate of frequency change. It
+can be also activated manually by the <<chronyc.adoc#smoothtime,*smoothtime
+activate*>> command, which is particularly useful when the clock is
+synchronised only with manual input and the skew is always larger than the
+threshold. The <<chronyc.adoc#smoothing,*smoothing*>> command can be used to
+monitor the process.
++
+An example suitable for clients using *ntpd* and 1024 second polling interval
+could be:
++
+----
+smoothtime 400 0.001
+----
++
+An example suitable for clients using *chronyd* on Linux could be:
++
+----
+smoothtime 50000 0.01
+----
+
+=== Command and monitoring access
+
+[[bindcmdaddress]]*bindcmdaddress* _address_::
+The *bindcmdaddress* directive allows you to specify the network interface on
+which *chronyd* will listen for monitoring command packets (issued by
+*chronyc*). This provides an additional level of access restriction above that
+available through the <<cmddeny,*cmddeny*>> mechanism.
++
+This directive can also change the path of the Unix domain command socket,
+which is used by *chronyc* to send configuration commands. The socket must be
+in a directory that is accessible only by the root or _chrony_ user. The
+directory will be created on start if it does not exist. The compiled-in default
+path of the socket is _@CHRONYSOCKDIR@/chronyd.sock_.
++
+By default, *chronyd* binds to the loopback interface (with addresses
+_127.0.0.1_ and _::1_). This blocks all access except from localhost. To listen
+for command packets on all interfaces, you can add the lines:
++
+----
+bindcmdaddress 0.0.0.0
+bindcmdaddress ::
+----
++
+to the configuration file.
++
+For each of the IPv4 and IPv6 protocols, only one *bindcmdaddress* directive can be
+specified.
++
+An example that sets the path of the Unix domain command socket is:
++
+----
+bindcmdaddress /var/run/chrony/chronyd.sock
+----
+
+[[cmdallow]]*cmdallow* [*all*] [_subnet_]::
+This is similar to the <<allow,*allow*>> directive, except that it allows
+monitoring access (rather than NTP client access) to a particular subnet or
+host. (By '`monitoring access`' is meant that *chronyc* can be run on those
+hosts and retrieve monitoring data from *chronyd* on this computer.)
++
+The syntax is identical to the *allow* directive.
++
+There is also a *cmdallow all* directive with similar behaviour to the *allow
+all* directive (but applying to monitoring access in this case, of course).
++
+Note that *chronyd* has to be configured with the
+<<bindcmdaddress,*bindcmdaddress*>> directive to not listen only on the
+loopback interface to actually allow remote access.
+
+[[cmddeny]]*cmddeny* [*all*] [_subnet_]::
+This is similar to the <<cmdallow,*cmdallow*>> directive, except that it denies
+monitoring access to a particular subnet or host, rather than allowing it.
++
+The syntax is identical.
++
+There is also a *cmddeny all* directive with similar behaviour to the *cmdallow
+all* directive.
+
+[[cmdport]]*cmdport* _port_::
+The *cmdport* directive allows the port that is used for run-time monitoring
+(via the *chronyc* program) to be altered from its default (323). If set to 0,
+*chronyd* will not open the port, this is useful to disable *chronyc*
+access from the Internet. (It does not disable the Unix domain command socket.)
++
+An example shows the syntax:
++
+----
+cmdport 257
+----
++
+This would make *chronyd* use UDP 257 as its command port. (*chronyc* would
+need to be run with the *-p 257* switch to inter-operate correctly.)
+
+[[cmdratelimit]]*cmdratelimit* [_option_]...::
+This directive enables response rate limiting for command packets. It is
+similar to the <<ratelimit,*ratelimit*>> directive, except responses to
+localhost are never limited and the default interval is 1 (2 seconds), the default
+burst is 16, and the default leak rate is 2.
++
+An example of the use of the directive is:
++
+----
+cmdratelimit interval 2
+----
+
+=== Real-time clock (RTC)
+
+[[hwclockfile]]*hwclockfile* _file_::
+The *hwclockfile* directive sets the location of the adjtime file which is
+used by the *hwclock* program on Linux. *chronyd* parses the file to find out
+if the RTC keeps local time or UTC. It overrides the <<rtconutc,*rtconutc*>>
+directive.
++
+The compiled-in default value is '_@DEFAULT_HWCLOCK_FILE@_'.
++
+An example of the directive is:
++
+----
+hwclockfile /etc/adjtime
+----
+
+[[rtcautotrim]]*rtcautotrim* _threshold_::
+The *rtcautotrim* directive is used to keep the RTC close to the system clock
+automatically. When the system clock is synchronised and the estimated error
+between the two clocks is larger than the specified threshold, *chronyd* will
+trim the RTC as if the <<chronyc.adoc#trimrtc,*trimrtc*>> command in *chronyc*
+was issued.
++
+This directive is effective only with the <<rtcfile,*rtcfile*>> directive.
++
+An example of the use of this directive is:
++
+----
+rtcautotrim 30
+----
++
+This would set the threshold error to 30 seconds.
+
+[[rtcdevice]]*rtcdevice* _device_::
+The *rtcdevice* directive sets the path to the device file for accessing the
+RTC. The default path is _/dev/rtc_.
+
+[[rtcfile]]*rtcfile* _file_::
+The *rtcfile* directive defines the name of the file in which *chronyd* can
+save parameters associated with tracking the accuracy of the RTC.
++
+An example of the directive is:
++
+----
+rtcfile @CHRONYVARDIR@/rtc
+----
++
+*chronyd* saves information in this file when it exits and when the *writertc*
+command is issued in *chronyc*. The information saved is the RTC's error at
+some epoch, that epoch (in seconds since January 1 1970), and the rate at which
+the RTC gains or loses time.
++
+So far, the support for real-time clocks is limited; their code is even more
+system-specific than the rest of the software. You can only use the RTC
+facilities (the <<rtcfile,*rtcfile*>> directive and the *-s* command-line
+option to *chronyd*) if the following three conditions apply:
++
+. You are running Linux.
+. The kernel is compiled with extended real-time clock support (i.e. the
+ _/dev/rtc_ device is capable of doing useful things).
+. You do not have other applications that need to make use of _/dev/rtc_ at all.
+
+[[rtconutc]]*rtconutc*::
+*chronyd* assumes by default that the RTC keeps local time (including any
+daylight saving changes). This is convenient on PCs running Linux which are
+dual-booted with Windows.
++
+If you keep the RTC on local time and your computer is off when daylight saving
+(summer time) starts or ends, the computer's system time will be one hour in
+error when you next boot and start chronyd.
++
+An alternative is for the RTC to keep Universal Coordinated Time (UTC). This
+does not suffer from the 1 hour problem when daylight saving starts or ends.
++
+If the *rtconutc* directive appears, it means the RTC is required to keep UTC.
+The directive takes no arguments. It is equivalent to specifying the *-u*
+switch to the Linux *hwclock* program.
++
+Note that this setting is overridden when the <<hwclockfile,*hwclockfile*>>
+directive is specified.
+
+[[rtcsync]]*rtcsync*::
+The *rtcsync* directive enables a mode where the system time is periodically
+copied to the RTC and *chronyd* does not try to track its drift. This directive
+cannot be used with the <<rtcfile,*rtcfile*>> directive.
++
+On Linux, the RTC copy is performed by the kernel every 11 minutes.
++
+On Mac OS X, <<chronyd,*chronyd*>> will perform the RTC copy every 60 minutes
+when the system clock is in a synchronised state.
++
+On other systems this directive does nothing.
+
+=== Logging
+
+[[log]]*log* [_option_]...::
+The *log* directive indicates that certain information is to be logged.
+The log files are written to the directory specified by the <<logdir,*logdir*>>
+directive. A banner is periodically written to the files to indicate the
+meanings of the columns.
++
+*measurements*:::
+This option logs the raw NTP measurements and related information to a file
+called _measurements.log_. An example line (which actually appears as a single
+line in the file) from the log file is shown below.
++
+----
+2015-10-13 05:40:50 203.0.113.15 N 2 111 111 1111 10 10 1.0 \
+ -4.966e-03 2.296e-01 1.577e-05 1.615e-01 7.446e-03
+----
++
+The columns are as follows (the quantities in square brackets are the values
+from the example line above):
++
+. Date [2015-10-13]
+. Hour:Minute:Second. Note that the date-time pair is expressed in UTC, not the
+ local time zone. [05:40:50]
+. IP address of server or peer from which measurement came [203.0.113.15]
+. Leap status (_N_ means normal, _+_ means that the last minute of the current
+ month has 61 seconds, _-_ means that the last minute of the month has 59
+ seconds, _?_ means the remote computer is not currently synchronised.) [N]
+. Stratum of remote computer. [2]
+. RFC 5905 tests 1 through 3 (1=pass, 0=fail) [111]
+. RFC 5905 tests 5 through 7 (1=pass, 0=fail) [111]
+. Tests for maximum delay, maximum delay ratio and maximum delay dev ratio,
+ against defined parameters, and a test for synchronisation loop (1=pass,
+ 0=fail) [1111]
+. Local poll [10]
+. Remote poll [10]
+. '`Score`' (an internal score within each polling level used to decide when to
+ increase or decrease the polling level. This is adjusted based on number of
+ measurements currently being used for the regression algorithm). [1.0]
+. The estimated local clock error (_theta_ in RFC 5905). Positive indicates
+ that the local clock is slow of the remote source. [-4.966e-03]
+. The peer delay (_delta_ in RFC 5905). [2.296e-01]
+. The peer dispersion (_epsilon_ in RFC 5905). [1.577e-05]
+. The root delay (_DELTA_ in RFC 5905). [1.615e-01]
+. The root dispersion (_EPSILON_ in RFC 5905). [7.446e-03]
++
+*statistics*:::
+This option logs information about the regression processing to a file called
+_statistics.log_. An example line (which actually appears as a single line in
+the file) from the log file is shown below.
++
+----
+2015-07-22 05:40:50 203.0.113.15 6.261e-03 -3.247e-03 \
+ 2.220e-03 1.874e-06 1.080e-06 7.8e-02 16 0 8
+----
++
+The columns are as follows (the quantities in square brackets are the values
+from the example line above):
++
+. Date [2015-07-22]
+. Hour:Minute:Second. Note that the date-time pair is expressed in
+ UTC, not the local time zone. [05:40:50]
+. IP address of server or peer from which measurement comes [203.0.113.15]
+. The estimated standard deviation of the measurements from the source (in
+ seconds). [6.261e-03]
+. The estimated offset of the source (in seconds, positive means the local
+ clock is estimated to be fast, in this case). [-3.247e-03]
+. The estimated standard deviation of the offset estimate (in seconds).
+ [2.220e-03]
+. The estimated rate at which the local clock is gaining or losing time
+ relative to the source (in seconds per second, positive means the local clock
+ is gaining). This is relative to the compensation currently being applied to
+ the local clock, _not_ to the local clock without any compensation.
+ [1.874e-06]
+. The estimated error in the rate value (in seconds per second). [1.080e-06].
+. The ratio of |old_rate - new_rate| / old_rate_error. Large values
+ indicate the statistics are not modelling the source very well. [7.8e-02]
+. The number of measurements currently being used for the regression
+ algorithm. [16]
+. The new starting index (the oldest sample has index 0; this is the method
+ used to prune old samples when it no longer looks like the measurements fit a
+ linear model). [0, i.e. no samples discarded this time]
+. The number of runs. The number of runs of regression residuals with the same
+ sign is computed. If this is too small it indicates that the measurements are
+ no longer represented well by a linear model and that some older samples need
+ to be discarded. The number of runs for the data that is being retained is
+ tabulated. Values of approximately half the number of samples are expected.
+ [8]
++
+*tracking*:::
+This option logs changes to the estimate of the system's gain or loss rate, and
+any slews made, to a file called _tracking.log_. An example line (which
+actually appears as a single line in the file) from the log file is shown
+below.
++
+----
+2015-02-23 05:40:50 203.0.113.15 3 340.529 1.606 1.046e-03 N \
+ 4 6.849e-03 -4.670e-04
+----
++
+The columns are as follows (the quantities in square brackets are the
+values from the example line above) :
++
+. Date [2015-02-03]
+. Hour:Minute:Second. Note that the date-time pair is expressed in UTC, not the
+ local time zone. [05:40:50]
+. The IP address of the server or peer to which the local system is synchronised.
+ [203.0.113.15]
+. The stratum of the local system. [3]
+. The local system frequency (in ppm, positive means the local system runs fast
+ of UTC). [340.529]
+. The error bounds on the frequency (in ppm). [1.606]
+. The estimated local offset at the epoch (which is rapidly corrected by
+ slewing the local clock. (In seconds, positive indicates the local system
+ is fast of UTC). [1.046e-3]
+. Leap status (_N_ means normal, _+_ means that the last minute of this month
+ has 61 seconds, _-_ means that the last minute of the month has 59 seconds,
+ _?_ means the clock is not currently synchronised.) [N]
+. The number of combined sources. [4]
+. The estimated standard deviation of the combined offset (in seconds).
+ [6.849e-03]
+. The remaining offset correction from the previous update (in seconds,
+ positive means the system clock is slow of UTC). [-4.670e-04]
++
+*rtc*:::
+This option logs information about the system's real-time clock. An example
+line (which actually appears as a single line in the file) from the _rtc.log_
+file is shown below.
++
+----
+2015-07-22 05:40:50 -0.037360 1 -0.037434\
+ -37.948 12 5 120
+----
++
+The columns are as follows (the quantities in square brackets are the
+values from the example line above):
++
+. Date [2015-07-22]
+. Hour:Minute:Second. Note that the date-time pair is expressed in UTC, not the
+ local time zone. [05:40:50]
+. The measured offset between the RTC and the system clock in seconds.
+ Positive indicates that the RTC is fast of the system time [-0.037360].
+. Flag indicating whether the regression has produced valid coefficients.
+ (1 for yes, 0 for no). [1]
+. Offset at the current time predicted by the regression process. A large
+ difference between this value and the measured offset tends to indicate that
+ the measurement is an outlier with a serious measurement error. [-0.037434]
+. The rate at which the RTC is losing or gaining time relative to the system
+ clock. In ppm, with positive indicating that the RTC is gaining time.
+ [-37.948]
+. The number of measurements used in the regression. [12]
+. The number of runs of regression residuals of the same sign. Low values
+ indicate that a straight line is no longer a good model of the measured data
+ and that older measurements should be discarded. [5]
+. The measurement interval used prior to the measurement being made (in
+ seconds). [120]
++
+*refclocks*:::
+This option logs the raw and filtered reference clock measurements to a file
+called _refclocks.log_. An example line (which actually appears as a single
+line in the file) from the log file is shown below.
++
+----
+2009-11-30 14:33:27.000000 PPS2 7 N 1 4.900000e-07 -6.741777e-07 1.000e-06
+----
++
+The columns are as follows (the quantities in square brackets are the values
+from the example line above):
++
+. Date [2009-11-30]
+. Hour:Minute:Second.Microsecond. Note that the date-time pair is expressed in
+ UTC, not the local time zone. [14:33:27.000000]
+. Reference ID of the reference clock from which the measurement came. [PPS2]
+. Sequence number of driver poll within one polling interval for raw samples,
+ or _-_ for filtered samples. [7]
+. Leap status (_N_ means normal, _+_ means that the last minute of the current
+ month has 61 seconds, _-_ means that the last minute of the month has 59
+ seconds). [N]
+. Flag indicating whether the sample comes from PPS source. (1 for yes,
+ 0 for no, or _-_ for filtered sample). [1]
+. Local clock error measured by reference clock driver, or _-_ for filtered sample.
+ [4.900000e-07]
+. Local clock error with applied corrections. Positive indicates that the local
+ clock is slow. [-6.741777e-07]
+. Assumed dispersion of the sample. [1.000e-06]
++
+*tempcomp*:::
+This option logs the temperature measurements and system rate compensations to
+a file called _tempcomp.log_. An example line (which actually appears as a
+single line in the file) from the log file is shown below.
++
+----
+2015-04-19 10:39:48 2.8000e+04 3.6600e-01
+----
++
+The columns are as follows (the quantities in square brackets are the values
+from the example line above):
++
+. Date [2015-04-19]
+. Hour:Minute:Second. Note that the date-time pair is expressed in UTC, not the
+ local time zone. [10:39:48]
+. Temperature read from the sensor. [2.8000e+04]
+. Applied compensation in ppm, positive means the system clock is running
+ faster than it would be without the compensation. [3.6600e-01]
++
+::
+An example of the directive is:
++
+----
+log measurements statistics tracking
+----
+
+[[logbanner]]*logbanner* _entries_::
+A banner is periodically written to the log files enabled by the <<log,*log*>>
+directive to indicate the meanings of the columns.
++
+The *logbanner* directive specifies after how many entries in the log file
+should be the banner written. The default is 32, and 0 can be used to disable
+it entirely.
+
+[[logchange]]*logchange* _threshold_::
+This directive sets the threshold for the adjustment of the system clock that
+will generate a syslog message. Clock errors detected via NTP packets,
+reference clocks, or timestamps entered via the
+<<chronyc.adoc#settime,*settime*>> command of *chronyc* are logged.
++
+By default, the threshold is 1 second.
++
+An example of the use is:
++
+----
+logchange 0.1
+----
++
+which would cause a syslog message to be generated if a system clock error of over
+0.1 seconds starts to be compensated.
+
+[[logdir]]*logdir* _directory_::
+This directive allows the directory where log files are written to be
+specified.
++
+An example of the use of this directive is:
++
+----
+logdir /var/log/chrony
+----
+
+[[mailonchange]]*mailonchange* _email_ _threshold_::
+This directive defines an email address to which mail should be sent if
+*chronyd* applies a correction exceeding a particular threshold to the system
+clock.
++
+An example of the use of this directive is:
++
+----
+mailonchange root@localhost 0.5
+----
++
+This would send a mail message to root if a change of more than 0.5 seconds
+were applied to the system clock.
++
+This directive cannot be used when a system call filter is enabled by the *-F*
+option as the *chronyd* process will not be allowed to fork and execute the
+sendmail binary.
+
+=== Miscellaneous
+
+[[include]]*include* _pattern_::
+The *include* directive includes a configuration file or multiple configuration
+files if a wildcard pattern is specified. This can be useful when maintaining
+configuration on multiple hosts to keep the differences in separate files.
++
+An example of the directive is:
++
+----
+include @SYSCONFDIR@/chrony.d/*.conf
+----
+
+[[keyfile]]*keyfile* _file_::
+This directive is used to specify the location of the file containing ID-key
+pairs for authentication of NTP packets.
++
+The format of the directive is shown in the example below:
++
+----
+keyfile @SYSCONFDIR@/chrony.keys
+----
++
+The argument is simply the name of the file containing the ID-key pairs. The
+format of the file is shown below:
++
+----
+10 tulip
+11 hyacinth
+20 MD5 ASCII:crocus
+25 SHA1 HEX:1dc764e0791b11fa67efc7ecbc4b0d73f68a070c
+ ...
+----
++
+Each line consists of an ID, name of an authentication hash function (optional),
+and a password. The ID can be any unsigned integer in the range 1 through
+2^32-1. The default hash function is *MD5*. Depending on how *chronyd*
+was compiled, other supported functions might be *SHA1*, *SHA256*, *SHA384*,
+*SHA512*, *RMD128*, *RMD160*, *RMD256*, *RMD320*, *TIGER*, and *WHIRLPOOL*. The
+password can be specified as a string of characters not containing white space
+with an optional *ASCII:* prefix, or as a hexadecimal number with the *HEX:*
+prefix. The maximum length of the line is 2047 characters.
++
+The password is used with the hash function to generate and verify a message
+authentication code (MAC) in NTP packets. It is recommended to use SHA1, or
+stronger, hash function with random passwords specified in the hexadecimal
+format that have at least 128 bits. *chronyd* will log a warning to
+syslog on start if a source is specified in the configuration file with a key
+that has password shorter than 80 bits.
++
+The <<chronyc.adoc#keygen,*keygen*>> command of *chronyc* can be used to
+generate random keys for the key file. By default, it generates 160-bit MD5 or
+SHA1 keys.
+
+[[lock_all]]*lock_all*::
+The *lock_all* directive will lock chronyd into RAM so that it will never be
+paged out. This mode is only supported on Linux. This directive uses the Linux
+*mlockall()* system call to prevent *chronyd* from ever being swapped out. This
+should result in lower and more consistent latency. It should not have
+significant impact on performance as *chronyd's* memory usage is modest. The
+*mlockall(2)* man page has more details.
+
+[[pidfile]]*pidfile* _file_::
+*chronyd* always writes its process ID (PID) to a file, and checks this file on
+startup to see if another *chronyd* may already be running on the system. By
+default, the file used is _/var/run/chronyd.pid_. The *pidfile* directive
+allows the name to be changed, e.g.:
++
+----
+pidfile /run/chronyd.pid
+----
+
+[[sched_priority]]*sched_priority* _priority_::
+On Linux, the *sched_priority* directive will select the SCHED_FIFO real-time
+scheduler at the specified priority (which must be between 0 and 100). On Mac
+OS X, this option must have either a value of 0 (the default) to disable the
+thread time constraint policy or 1 for the policy to be enabled. Other systems
+do not support this option.
++
+On Linux, this directive uses the *sched_setscheduler()* system call to
+instruct the kernel to use the SCHED_FIFO first-in, first-out real-time
+scheduling policy for *chronyd* with the specified priority. This means that
+whenever *chronyd* is ready to run it will run, interrupting whatever else is
+running unless it is a higher priority real-time process. This should not
+impact performance as *chronyd* resource requirements are modest, but it should
+result in lower and more consistent latency since *chronyd* will not need to
+wait for the scheduler to get around to running it. You should not use this
+unless you really need it. The *sched_setscheduler(2)* man page has more
+details.
++
+On Mac OS X, this directive uses the *thread_policy_set()* kernel call to
+specify real-time scheduling. As noted for Linux, you should not use this
+directive unless you really need it.
+
+[[user]]*user* _user_::
+The *user* directive sets the name of the system user to which *chronyd* will
+switch after start in order to drop root privileges.
++
+On Linux, *chronyd* needs to be compiled with support for the *libcap* library.
+On Mac OS X, FreeBSD, NetBSD and Solaris *chronyd* forks into two processes.
+The child process retains root privileges, but can only perform a very limited
+range of privileged system calls on behalf of the parent.
++
+The compiled-in default value is _@DEFAULT_USER@_.
+
+[[examples]]
+== EXAMPLES
+
+=== NTP client with permanent connection to NTP servers
+
+This section shows how to configure *chronyd* for computers that are connected
+to the Internet (or to any network containing true NTP servers which ultimately
+derive their time from a reference clock) permanently or most of the time.
+
+To operate in this mode, you will need to know the names of the NTP servers
+you want to use. You might be able to find names of suitable servers by one of
+the following methods:
+
+* Your institution might already operate servers on its network.
+ Contact your system administrator to find out.
+* Your ISP probably has one or more NTP servers available for its
+ customers.
+* Somewhere under the NTP homepage there is a list of public
+ stratum 1 and stratum 2 servers. You should find one or more servers that are
+ near to you. Check that their access policy allows you to use their
+ facilities.
+* Use public servers from the http://www.pool.ntp.org/[pool.ntp.org] project.
+
+Assuming that your NTP servers are called _foo.example.net_, _bar.example.net_
+and _baz.example.net_, your _chrony.conf_ file could contain as a minimum:
+
+----
+server foo.example.net
+server bar.example.net
+server baz.example.net
+----
+
+However, you will probably want to include some of the other directives. The
+<<driftfile,*driftfile*>>, <<makestep,*makestep*>> and <<rtcsync,*rtcsync*>>
+might be particularly useful. Also, the *iburst* option of the
+<<server,*server*>> directive is useful to speed up the initial
+synchronisation. The smallest useful configuration file would look something
+like:
+
+----
+server foo.example.net iburst
+server bar.example.net iburst
+server baz.example.net iburst
+driftfile @CHRONYVARDIR@/drift
+makestep 1.0 3
+rtcsync
+----
+
+When using a pool of NTP servers (one name is used for multiple servers which
+might change over time), it is better to specify them with the <<pool,*pool*>>
+directive instead of multiple *server* directives. The configuration file could
+in this case look like:
+
+----
+pool pool.ntp.org iburst
+driftfile @CHRONYVARDIR@/drift
+makestep 1.0 3
+rtcsync
+----
+
+=== NTP client with infrequent connection to NTP servers
+
+This section shows how to configure *chronyd* for computers that have
+occasional connections to NTP servers. In this case, you will need some
+additional configuration to tell *chronyd* when the connection goes up and
+down. This saves the program from continuously trying to poll the servers when
+they are inaccessible.
+
+Again, assuming that your NTP servers are called _foo.example.net_,
+_bar.example.net_ and _baz.example.net_, your _chrony.conf_ file would now
+contain:
+
+----
+server foo.example.net offline
+server bar.example.net offline
+server baz.example.net offline
+driftfile @CHRONYVARDIR@/drift
+makestep 1.0 3
+rtcsync
+----
+
+The *offline* keyword indicates that the servers start in an offline state, and
+that they should not be contacted until *chronyd* receives notification from
+*chronyc* that the link to the Internet is present. To tell *chronyd* when to
+start and finish sampling the servers, the <<chronyc.adoc#online,*online*>> and
+<<chronyc.adoc#offline,*offline*>> commands of *chronyc* need to be used.
+
+To give an example of their use, assuming that *pppd* is the program being
+used to connect to the Internet and that *chronyc* has been installed at
+_@BINDIR@/chronyc_, the script _/etc/ppp/ip-up_ would include:
+
+----
+@BINDIR@/chronyc online
+----
+
+and the script _/etc/ppp/ip-down_ would include:
+
+----
+@BINDIR@/chronyc offline
+----
+
+*chronyd*'s polling of the servers would now only occur whilst the machine is
+actually connected to the Internet.
+
+=== Isolated networks
+
+This section shows how to configure *chronyd* for computers that never have
+network conectivity to any computer which ultimately derives its time from a
+reference clock.
+
+In this situation, one computer is selected to be the master timeserver. The
+other computers are either direct clients of the master, or clients of clients.
+
+The <<local,*local*>> directive enables a local reference mode, which allows
+*chronyd* to appear synchronised even when it is not.
+
+The rate value in the master's drift file needs to be set to the average rate
+at which the master gains or loses time. *chronyd* includes support for this,
+in the form of the <<manual,*manual*>> directive and the
+<<chronyc.adoc#settime,*settime*>> command in the *chronyc* program.
+
+If the master is rebooted, *chronyd* can re-read the drift rate from the drift
+file. However, the master has no accurate estimate of the current time. To get
+around this, the system can be configured so that the master can initially set
+itself to a '`majority-vote`' of selected clients' times; this allows the
+clients to '`flywheel`' the master while it is rebooting.
+
+The <<smoothtime,*smoothtime*>> directive is useful when the clocks of the
+clients need to stay close together when the local time is adjusted by the
+<<chronyc.adoc#settime,*settime*>> command. The smoothing process needs to be
+activated by the <<chronyc.adoc#smoothtime,*smoothtime activate*>> command when
+the local time is ready to be served. After that point, any adjustments will be
+smoothed out.
+
+A typical configuration file for the master (called _master_) might be
+(assuming the clients and the master are in the _192.168.165.x_ subnet):
+
+----
+initstepslew 1 client1 client3 client6
+driftfile @CHRONYVARDIR@/drift
+local stratum 8
+manual
+allow 192.168.165.0/24
+smoothtime 400 0.01
+rtcsync
+----
+
+For the clients that have to resynchronise the master when it restarts,
+the configuration file might be:
+
+----
+server master iburst
+driftfile @CHRONYVARDIR@/drift
+allow 192.168.165.0/24
+makestep 1.0 3
+rtcsync
+----
+
+The rest of the clients would be the same, except that the *allow* directive is
+not required.
+
+If there is no suitable computer to be designated as the master, or there is a
+requirement to keep the clients synchronised even when it fails, the *orphan*
+option of the *local* directive enables a special mode where the master is
+selected from multiple computers automatically. They all need to use the same
+*local* configuration and poll one another. The server with the smallest
+reference ID (which is based on its IP address) will take the role of the
+master and others will be synchronised to it. When it fails, the server with
+the second smallest reference ID will take over and so on.
+
+A configuration file for the first server might be (assuming there are three
+servers called _master1_, _master2_, and _master3_):
+
+----
+initstepslew 1 master2 master3
+server master2
+server master3
+driftfile @CHRONYVARDIR@/drift
+local stratum 8 orphan
+manual
+allow 192.168.165.0/24
+rtcsync
+----
+
+The other servers would be the same, except the hostnames in the *initstepslew*
+and *server* directives would be modified to specify the other servers. Their
+clients might be configured to poll all three servers.
+
+=== RTC tracking
+
+This section considers a computer which has occasional connections to the
+Internet and is turned off between '`sessions`'. In this case, *chronyd* relies
+on the computer's RTC to maintain the time between the periods when it is
+powered up. It assumes that Linux is run exclusively on the computer. Dual-boot
+systems might work; it depends what (if anything) the other system does to the
+RTC. On 2.6 and later kernels, if your motherboard has a HPET, you will need to
+enable the *HPET_EMULATE_RTC* option in your kernel configuration. Otherwise,
+*chronyd* will not be able to interact with the RTC device and will give up
+using it.
+
+When the computer is connected to the Internet, *chronyd* has access to
+external NTP servers which it makes measurements from. These measurements are
+saved, and straight-line fits are performed on them to provide an estimate of
+the computer's time error and rate of gaining or losing time.
+
+When the computer is taken offline from the Internet, the best estimate of the
+gain or loss rate is used to free-run the computer until it next goes online.
+
+Whilst the computer is running, *chronyd* makes measurements of the RTC (via
+the _/dev/rtc_ interface, which must be compiled into the kernel). An estimate
+is made of the RTC error at a particular RTC second, and the rate at which the
+RTC gains or loses time relative to true time.
+
+When the computer is powered down, the measurement histories for all the NTP
+servers are saved to files (if the <<dumponexit,*dumponexit*>> directive is
+specified in the configuration file), and the RTC tracking information is also
+saved to a file (if the <<rtcfile,*rtcfile*>> directive has been specified).
+These pieces of information are also saved if the <<chronyc.adoc#dump,*dump*>>
+and <<chronyc.adoc#writertc,*writertc*>> commands respectively are issued
+through *chronyc*.
+
+When the computer is rebooted, *chronyd* reads the current RTC time and the RTC
+information saved at the last shutdown. This information is used to set the
+system clock to the best estimate of what its time would have been now, had it
+been left running continuously. The measurement histories for the servers are
+then reloaded.
+
+The next time the computer goes online, the previous sessions' measurements can
+contribute to the line-fitting process, which gives a much better estimate of
+the computer's gain or loss rate.
+
+One problem with saving the measurements and RTC data when the machine is shut
+down is what happens if there is a power failure; the most recent data will not
+be saved. Although *chronyd* is robust enough to cope with this, some
+performance might be lost. (The main danger arises if the RTC has been changed
+during the session, with the *trimrtc* command in *chronyc*. Because of this,
+*trimrtc* will make sure that a meaningful RTC file is saved after the
+change is completed).
+
+The easiest protection against power failure is to put the *dump* and
+*writertc* commands in the same place as the *offline* command is issued to
+take *chronyd* offline; because *chronyd* free-runs between online sessions, no
+parameters will change significantly between going offline from the Internet
+and any power failure.
+
+A final point regards computers which are left running for extended periods and
+where it is desired to spin down the hard disc when it is not in use (e.g. when
+not accessed for 15 minutes). *chronyd* has been planned so it supports such
+operation; this is the reason why the RTC tracking parameters are not saved to
+disc after every update, but only when the user requests such a write, or
+during the shutdown sequence. The only other facility that will generate
+periodic writes to the disc is the *log rtc* facility in the configuration
+file; this option should not be used if you want your disc to spin down.
+
+To illustrate how a computer might be configured for this case, example
+configuration files are shown.
+
+For the _chrony.conf_ file, the following can be used as an example.
+
+----
+server foo.example.net maxdelay 0.4 offline
+server bar.example.net maxdelay 0.4 offline
+server baz.example.net maxdelay 0.4 offline
+logdir /var/log/chrony
+log statistics measurements tracking
+driftfile @CHRONYVARDIR@/drift
+makestep 1.0 3
+maxupdateskew 100.0
+dumponexit
+dumpdir @CHRONYVARDIR@
+rtcfile @CHRONYVARDIR@/rtc
+----
+
+*pppd* is used for connecting to the Internet. This runs two scripts
+_/etc/ppp/ip-up_ and _/etc/ppp/ip-down_ when the link goes online and offline
+respectively.
+
+The relevant part of the _/etc/ppp/ip-up_ file is:
+
+----
+@BINDIR@/chronyc online
+----
+
+and the relevant part of the _/etc/ppp/ip-down_ script is:
+
+----
+@BINDIR@/chronyc -m offline dump writertc
+----
+
+*chronyd* is started during the boot sequence with the *-r* and *-s* options.
+It might need to be started before any software that depends on the system clock
+not jumping or moving backwards, depending on the directives in *chronyd*'s
+configuration file.
+
+For the system shutdown, *chronyd* should receive a SIGTERM several seconds
+before the final SIGKILL; the SIGTERM causes the measurement histories and RTC
+information to be saved.
+
+== SEE ALSO
+
+<<chronyc.adoc#,*chronyc(1)*>>, <<chronyd.adoc#,*chronyd(8)*>>
+
+== BUGS
+
+For instructions on how to report bugs, please visit
+https://chrony.tuxfamily.org/.
+
+== AUTHORS
+
+chrony was written by Richard Curnow, Miroslav Lichvar, and others.
diff --git a/doc/chrony.conf.man.in b/doc/chrony.conf.man.in
new file mode 100644
index 0000000..8e76a73
--- /dev/null
+++ b/doc/chrony.conf.man.in
@@ -0,0 +1,3432 @@
+'\" t
+.\" Title: chrony.conf
+.\" Author: [see the "AUTHORS" section]
+.\" Generator: Asciidoctor 1.5.4
+.\" Date: 2016-06-07
+.\" Manual: Configuration Files
+.\" Source: chrony @CHRONY_VERSION@
+.\" Language: English
+.\"
+.TH "CHRONY.CONF" "5" "2016-06-07" "chrony @CHRONY_VERSION@" "Configuration Files"
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.ss \n[.ss] 0
+.nh
+.ad l
+.de URL
+\\$2 \(laURL: \\$1 \(ra\\$3
+..
+.if \n[.g] .mso www.tmac
+.LINKSTYLE blue R < >
+.SH "NAME"
+chrony.conf \- chronyd configuration file
+.SH "SYNOPSIS"
+.sp
+\fBchrony.conf\fP
+.SH "DESCRIPTION"
+.sp
+This file configures the \fBchronyd\fP daemon. The compiled\-in location is
+\fI@SYSCONFDIR@/chrony.conf\fP, but other locations can be specified on the
+\fBchronyd\fP command line with the \fB\-f\fP option.
+.sp
+Each directive in the configuration file is placed on a separate line. The
+following sections describe each of the directives in turn. The directives can
+occur in any order in the file and they are not case\-sensitive.
+.sp
+The configuration directives can also be specified directly on the \fBchronyd\fP
+command line. In this case each argument is parsed as a new line and the
+configuration file is ignored.
+.sp
+While the number of supported directives is large, only a few of them are
+typically needed. See the \fBEXAMPLES\fP section for configuration in
+typical operating scenarios.
+.sp
+The configuration file might contain comment lines. A comment line is any line
+that starts with zero or more spaces followed by any one of the following
+characters: \fB!\fP, \fB;\fP, \fB#\fP, \fB%\fP. Any line with this format will be ignored.
+.SH "DIRECTIVES"
+.SS "Time sources"
+.sp
+\fBserver\fP \fIhostname\fP [\fIoption\fP]...
+.RS 4
+The \fBserver\fP directive specifies an NTP server which can be used as a time
+source. The client\-server relationship is strictly hierarchical: a client might
+synchronise its system time to that of the server, but the server\(cqs system time
+will never be influenced by that of a client.
+.sp
+The \fBserver\fP directive is immediately followed by either the name of the
+server, or its IP address. The \fBserver\fP directive supports the following
+options:
+.sp
+\fBminpoll\fP \fIpoll\fP
+.RS 4
+Although \fBchronyd\fP will trim the rate at which it samples the server during
+normal operation, the user might want to constrain the minimum polling interval.
+This is always defined as a power of 2, so \fBminpoll 5\fP would mean that the
+polling interval cannot drop below 32 seconds. The default is 6 (64 seconds).
+.RE
+.sp
+\fBmaxpoll\fP \fIpoll\fP
+.RS 4
+In a similar way, the user might want to constrain the maximum polling interval.
+Again this is specified as a power of 2, \fBmaxpoll 9\fP indicates that the polling
+interval must stay at or below 512 seconds. The default is 10 (1024 seconds).
+.RE
+.sp
+\fBiburst\fP
+.RS 4
+If this option is set, the interval between the first four polls will be 2
+seconds instead of \fIminpoll\fP. This is useful to quickly get the first update of
+the clock after \fBchronyd\fP is started.
+.RE
+.sp
+\fBkey\fP \fIid\fP
+.RS 4
+The NTP protocol supports the inclusion of checksums in the packets, to prevent
+computers having their system time upset by rogue packets being sent to them.
+The checksums are generated as a function of a password, using the
+cryptographic hash function set in the key file, which is specified by the
+\fBkeyfile\fP directive.
+.sp
+If the key option is present, \fBchronyd\fP will attempt to use authenticated
+packets when communicating with this server. The key number used will be the
+single argument to the key option (an unsigned integer in the range 1 through
+2^32\-1). The server must have the same password for this key number configured,
+otherwise no relationship between the computers will be possible.
+.RE
+.sp
+\fBmaxdelay\fP \fIdelay\fP
+.RS 4
+\fBchronyd\fP uses the network round\-trip delay to the server to determine how
+accurate a particular measurement is likely to be. Long round\-trip delays
+indicate that the request, or the response, or both were delayed. If only one
+of the messages was delayed the measurement error is likely to be substantial.
+.sp
+For small variations in the round\-trip delay, \fBchronyd\fP uses a weighting scheme
+when processing the measurements. However, beyond a certain level of delay the
+measurements are likely to be so corrupted as to be useless. (This is
+particularly so on dial\-up or other slow links, where a long delay probably
+indicates a highly asymmetric delay caused by the response waiting behind a lot
+of packets related to a download of some sort).
+.sp
+If the user knows that round trip delays above a certain level should cause the
+measurement to be ignored, this level can be defined with the \fBmaxdelay\fP
+option. For example, \fBmaxdelay 0.3\fP would indicate that measurements with a
+round\-trip delay of 0.3 seconds or more should be ignored. The default value is
+3 seconds.
+.RE
+.sp
+\fBmaxdelayratio\fP \fIratio\fP
+.RS 4
+This option is similar to the maxdelay option above. \fBchronyd\fP keeps a record
+of the minimum round\-trip delay amongst the previous measurements that it has
+buffered. If a measurement has a round trip delay that is greater than the
+maxdelayratio times the minimum delay, it will be rejected.
+.RE
+.sp
+\fBmaxdelaydevratio\fP \fIratio\fP
+.RS 4
+If a measurement has a ratio of the increase in the round\-trip delay from the
+minimum delay amongst the previous measurements to the standard deviation of
+the previous measurements that is greater than the specified ratio, it will be
+rejected. The default is 10.0.
+.RE
+.sp
+\fBminsamples\fP \fIsamples\fP
+.RS 4
+Set the minimum number of samples kept for this source. This overrides the
+\fBminsamples\fP directive.
+.RE
+.sp
+\fBmaxsamples\fP \fIsamples\fP
+.RS 4
+Set the maximum number of samples kept for this source. This overrides the
+\fBmaxsamples\fP directive.
+.RE
+.sp
+\fBoffline\fP
+.RS 4
+If the server will not be reachable when \fBchronyd\fP is started, the \fBoffline\fP
+option can be specified. \fBchronyd\fP will not try to poll the server until it is
+enabled to do so (by using the \fBonline\fP command in
+\fBchronyc\fP).
+.RE
+.sp
+\fBauto_offline\fP
+.RS 4
+If this option is set, the server will be assumed to have gone offline when 2
+requests have been sent to it without receiving a response. This option avoids
+the need to run the \fBoffline\fP command from \fBchronyc\fP
+when disconnecting the network link. (It will still be necessary to use the
+\fBonline\fP command when the link has been established, to
+enable measurements to start.)
+.RE
+.sp
+\fBprefer\fP
+.RS 4
+Prefer this source over sources without prefer option.
+.RE
+.sp
+\fBnoselect\fP
+.RS 4
+Never select this source. This is particularly useful for monitoring.
+.RE
+.sp
+\fBtrust\fP
+.RS 4
+Assume time from this source is always true. It can be rejected as a
+falseticker in the source selection only if another source with this option
+does not agree with it.
+.RE
+.sp
+\fBrequire\fP
+.RS 4
+Require that at least one of the sources specified with this option is
+selectable (i.e. recently reachable and not a falseticker) before updating the
+clock. Together with the \fBtrust\fP option this might be useful to allow a trusted
+authenticated source to be safely combined with unauthenticated sources in
+order to improve the accuracy of the clock. They can be selected and used for
+synchronisation only if they agree with the trusted and required source.
+.RE
+.sp
+\fBpolltarget\fP \fItarget\fP
+.RS 4
+Target number of measurements to use for the regression algorithm which
+\fBchronyd\fP will try to maintain by adjusting the polling interval between
+\fBminpoll\fP and \fBmaxpoll\fP. A higher target makes \fBchronyd\fP prefer shorter polling
+intervals. The default is 6 and a useful range is from 6 to 60.
+.RE
+.sp
+\fBport\fP \fIport\fP
+.RS 4
+This option allows the UDP port on which the server understands NTP requests to
+be specified. For normal servers this option should not be required (the
+default is 123, the standard NTP port).
+.RE
+.sp
+\fBpresend\fP \fIpoll\fP
+.RS 4
+If the timing measurements being made by \fBchronyd\fP are the only network data
+passing between two computers, you might find that some measurements are badly
+skewed due to either the client or the server having to do an ARP lookup on the
+other party prior to transmitting a packet. This is more of a problem with long
+sampling intervals, which might be similar in duration to the lifetime of entries
+in the ARP caches of the machines.
+.sp
+In order to avoid this problem, the \fBpresend\fP option can be used. It takes a
+single integer argument, which is the smallest polling interval for which an
+extra pair of NTP packets will be exchanged between the client and the server
+prior to the actual measurement. For example, with the following option
+included in a \fBserver\fP directive:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+presend 9
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+when the polling interval is 512 seconds or more, an extra NTP client packet
+will be sent to the server a short time (4 seconds) before making the actual
+measurement.
+.RE
+.sp
+\fBminstratum\fP \fIstratum\fP
+.RS 4
+When the synchronisation source is selected from available sources, sources
+with lower stratum are normally slightly preferred. This option can be used to
+increase stratum of the source to the specified minimum, so \fBchronyd\fP will
+avoid selecting that source. This is useful with low stratum sources that are
+known to be unreliable or inaccurate and which should be used only when other
+sources are unreachable.
+.RE
+.sp
+\fBversion\fP \fIversion\fP
+.RS 4
+This option sets the NTP version number used in packets sent to the server.
+This can be useful when the server runs an old NTP implementation that does not
+respond to newer versions. The default version number is 4.
+.RE
+.RE
+.sp
+\fBpool\fP \fIname\fP [\fIoption\fP]...
+.RS 4
+The syntax of this directive is similar to that for the \fBserver\fP
+directive, except that it is used to specify a pool of NTP servers rather than
+a single NTP server. The pool name is expected to resolve to multiple addresses
+which might change over time.
+.sp
+All options valid in the \fBserver\fP directive can be used in this
+directive too. There is one option specific to the \fBpool\fP directive:
+\fBmaxsources\fP sets the maximum number of sources that can be used from the pool,
+the default value is 4.
+.sp
+On start, when the pool name is resolved, \fBchronyd\fP will add up to 16 sources,
+one for each resolved address. When the number of sources from which at least
+one valid reply was received reaches the number specified by the \fBmaxsources\fP
+option, the other sources will be removed. When a pool source is unreachable,
+marked as a falseticker, or has a distance larger than the limit set by the
+\fBmaxdistance\fP directive, \fBchronyd\fP will try to replace the
+source with a newly resolved address from the pool.
+.sp
+An example of the \fBpool\fP directive is
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+pool pool.ntp.org iburst maxsources 3
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBpeer\fP \fIhostname\fP [\fIoption\fP]...
+.RS 4
+The syntax of this directive is identical to that for the \fBserver\fP
+directive, except that it is used to specify an NTP peer rather than an NTP
+server.
+.sp
+When a key is specified by the \fBkey\fP option to enable authentication, both
+peers must be configured to use the same key and the same key number.
+.sp
+Please note that NTP peers that are not configured with a key to enable
+authentication are vulnerable to a denial\-of\-service attack. An attacker
+knowing that NTP hosts A and B are peering with each other can send a packet
+with random timestamps to host A with source address of B which will set the
+NTP state variables on A to the values sent by the attacker. Host A will then
+send on its next poll to B a packet with an origin timestamp that does not match
+the transmit timestamp of B and the packet will be dropped. If the attacker
+does this periodically for both hosts, they will not be able to synchronise to
+each other.
+.sp
+This attack can be prevented by enabling authentication with the \fBkey\fP option,
+or by using the \fBserver\fP directive on both sides to specify the other
+host as a server instead of a peer. The disadvantage of the \fBserver\fP directive
+is that it will double the network traffic between the two hosts.
+.RE
+.sp
+\fBinitstepslew\fP \fIstep\-threshold\fP [\fIhostname\fP]...
+.RS 4
+In normal operation, \fBchronyd\fP slews the time when it needs to adjust the
+system clock. For example, to correct a system clock which is 1 second slow,
+\fBchronyd\fP slightly increases the amount by which the system clock is advanced
+on each clock interrupt, until the error is removed. Note that at no time does
+time run backwards with this method.
+.sp
+On most Unix systems it is not desirable to step the system clock, because many
+programs rely on time advancing monotonically forwards.
+.sp
+When the \fBchronyd\fP daemon is initially started, it is possible that the system
+clock is considerably in error. Attempting to correct such an error by slewing
+might not be sensible, since it might take several hours to correct the error by
+this means.
+.sp
+The purpose of the \fBinitstepslew\fP directive is to allow \fBchronyd\fP to make a
+rapid measurement of the system clock error at boot time, and to correct the
+system clock by stepping before normal operation begins. Since this would
+normally be performed only at an appropriate point in the system boot sequence,
+no other software should be adversely affected by the step.
+.sp
+If the correction required is less than a specified threshold, a slew is used
+instead. This makes it safer to restart \fBchronyd\fP whilst the system is in
+normal operation.
+.sp
+The \fBinitstepslew\fP directive takes a threshold and a list of NTP servers as
+arguments. Each of the servers is rapidly polled several times, and a majority
+voting mechanism used to find the most likely range of system clock error that
+is present. A step or slew is applied to the system clock to correct this
+error. \fBchronyd\fP then enters its normal operating mode.
+.sp
+An example of the use of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+initstepslew 30 foo.example.net bar.example.net
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+where 2 NTP servers are used to make the measurement. The \fI30\fP indicates that
+if the system\(cqs error is found to be 30 seconds or less, a slew will be used to
+correct it; if the error is above 30 seconds, a step will be used.
+.sp
+The \fBinitstepslew\fP directive can also be used in an isolated LAN environment,
+where the clocks are set manually. The most stable computer is chosen as the
+master, and the other computers are slaved to it. If each of the slaves is
+configured with the \fBlocal\fP directive, the master can be set up with
+an \fBinitstepslew\fP directive which references some or all of the slaves. Then,
+if the master machine has to be rebooted, the slaves can be relied on to act
+analogously to a flywheel and preserve the time for a short period while the
+master completes its reboot.
+.sp
+The \fBinitstepslew\fP directive is functionally similar to a combination of the
+\fBmakestep\fP and \fBserver\fP directives with the \fBiburst\fP
+option. The main difference is that the \fBinitstepslew\fP servers are used only
+before normal operation begins and that the foreground \fBchronyd\fP process waits
+for \fBinitstepslew\fP to finish before exiting. This is useful to prevent programs
+started in the boot sequence after \fBchronyd\fP from reading the clock before it
+has been stepped.
+.RE
+.sp
+\fBrefclock\fP \fIdriver\fP \fIparameter\fP [\fIoption\fP]...
+.RS 4
+The \fBrefclock\fP directive specifies a hardware reference clock to be used as a
+time source. It has two mandatory parameters, a driver name and a
+driver\-specific parameter.
+.sp
+There are currently four drivers included:
+.sp
+\fBPPS\fP
+.RS 4
+Driver for the kernel PPS (pulse per second) API. The parameter is the path to
+the PPS device (typically \fI/dev/pps?\fP). The assert events are used for
+synchronisation by default. String \fB:clear\fP can be appended to the path to use
+the clear events instead.
+.sp
+As PPS refclocks don\(cqt supply full time, \fBchronyd\fP needs to be configured with
+another time source (NTP or non\-PPS refclock) in order to complete samples from
+the PPS refclock. An alternative is to enable the \fBlocal\fP directive
+to allow synchronisation with some unknown but constant offset.
+For example:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+refclock PPS /dev/pps0 lock NMEA
+refclock SHM 0 offset 0.5 delay 0.2 refid NMEA noselect
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBSHM\fP
+.RS 4
+NTP shared memory driver. This driver uses a shared memory segment to receive
+samples from another process. The parameter is the number of the shared memory
+segment, typically 0, 1, 2 or 3. For example:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+refclock SHM 1 poll 3 refid GPS1
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+A driver option in form of \fB:perm=NNN\fP can be appended to the segment number to
+create the segment with permissions other than the default 0600.
+.sp
+Examples of applications that can be used as SHM refclocks are
+.URL "http://www.catb.org/gpsd/" "\fBgpsd\fP" ","
+.URL "http://www.buzzard.me.uk/jonathan/radioclock.html" "\fBradioclk\fP" ","
+and
+.URL "https://www.vanheusden.com/time/omnisync/" "\fBomnisync\fP" "."
+.RE
+.sp
+\fBSOCK\fP
+.RS 4
+Unix domain socket driver. It is similar to the SHM driver, but samples are
+received from a Unix domain socket instead of shared memory and the messages
+have a different format. The parameter is the path to the socket, which
+\fBchronyd\fP creates on start. An advantage over the SHM driver is that SOCK does
+not require polling and it can receive PPS samples with incomplete time. The
+format of the messages is described in the \fIrefclock_sock.c\fP file in the chrony
+source code.
+.sp
+An application which supports the SOCK protocol is the \fBgpsd\fP daemon. The path
+where \fBgpsd\fP expects the socket to be created is described in the \fBgpsd(8)\fP man
+page. For example:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+refclock SOCK /var/run/chrony.ttyS0.sock
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBPHC\fP
+.RS 4
+PTP hardware clock (PHC) driver. The parameter is the path to the device of
+the PTP clock, which for example can be synchronised by \fBptp4l\fP from
+.URL "http://linuxptp.sourceforge.net" "\fBlinuxptp\fP" "."
+PTP clocks are typically kept in
+TAI instead of UTC, so the \fBoffset\fP option should be used to compensate for the
+current UTC\-TAI offset. For example:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+refclock PHC /dev/ptp0 poll 3 dpoll \-2 offset \-36
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.RE
+.sp
+
+.RS 4
+The \fBrefclock\fP directive also supports a number of options:
+.sp
+\fBpoll\fP \fIpoll\fP
+.RS 4
+Timestamps produced by refclock drivers are not used immediately, but they are
+stored and processed by a median filter in the polling interval specified by
+this option. This is defined as a power of 2 and can be negative to specify a
+sub\-second interval. The default is 4 (16 seconds). A shorter interval allows
+\fBchronyd\fP to react faster to changes in the frequency of the system clock, but
+it might have a negative effect on its accuracy if the samples have a lot of
+jitter.
+.RE
+.sp
+\fBdpoll\fP \fIdpoll\fP
+.RS 4
+Some drivers do not listen for external events and try to produce samples in
+their own polling interval. This is defined as a power of 2 and can be negative
+to specify a sub\-second interval. The default is 0 (1 second).
+.RE
+.sp
+\fBrefid\fP \fIrefid\fP
+.RS 4
+This option is used to specify the reference ID of the refclock, as up to four
+ASCII characters. The default reference ID is composed from the first three
+characters of the driver name and the number of the refclock. Each refclock
+must have a unique reference ID.
+.RE
+.sp
+\fBlock\fP \fIrefid\fP
+.RS 4
+This option can be used to lock a PPS refclock to another refclock, which is
+specified by its reference ID. In this mode received PPS samples are paired
+directly with raw samples from the specified refclock.
+.RE
+.sp
+\fBrate\fP \fIrate\fP
+.RS 4
+This option sets the rate of the pulses in the PPS signal (in Hz). This option
+controls how the pulses will be completed with real time. To actually receive
+more than one pulse per second, a negative \fBdpoll\fP has to be specified (\-3 for
+a 5Hz signal). The default is 1.
+.RE
+.sp
+\fBoffset\fP \fIoffset\fP
+.RS 4
+This option can be used to compensate for a constant error. The specified
+offset (in seconds) is applied to all samples produced by the reference clock.
+The default is 0.0.
+.RE
+.sp
+\fBdelay\fP \fIdelay\fP
+.RS 4
+This option sets the NTP delay of the source (in seconds). Half of this value
+is included in the maximum assumed error which is used in the source selection
+algorithm. Increasing the delay is useful to avoid having no majority in the
+source selection or to make it prefer other sources. The default is 1e\-9 (1
+nanosecond).
+.RE
+.sp
+\fBprecision\fP \fIprecision\fP
+.RS 4
+This option sets the refclock precision (in seconds). The default is 1e\-6 (1
+microsecond) for SHM refclock, and 1e\-9 (1 nanosecond) for SOCK, PPS and PHC
+refclocks.
+.RE
+.sp
+\fBmaxdispersion\fP \fIdispersion\fP
+.RS 4
+Maximum allowed dispersion for filtered samples (in seconds). Samples with
+larger estimated dispersion are ignored. By default, this limit is disabled.
+.RE
+.sp
+\fBfilter\fP \fIsamples\fP
+.RS 4
+This option sets the length of the median filter which is used to reduce the
+noise in the measurements. With each poll about 40 percent of the stored
+samples are discarded and one final sample is calculated as an average of the
+remaining samples. If the length is 4 or more, at least 4 samples have to be
+collected between polls. For lengths below 4, the filter has to be full. The
+default is 64.
+.RE
+.sp
+\fBprefer\fP
+.RS 4
+Prefer this source over sources without the prefer option.
+.RE
+.sp
+\fBnoselect\fP
+.RS 4
+Never select this source. This is useful for monitoring or with sources which
+are not very accurate, but are locked with a PPS refclock.
+.RE
+.sp
+\fBtrust\fP
+.RS 4
+Assume time from this source is always true. It can be rejected as a
+falseticker in the source selection only if another source with this option
+does not agree with it.
+.RE
+.sp
+\fBrequire\fP
+.RS 4
+Require that at least one of the sources specified with this option is
+selectable (i.e. recently reachable and not a falseticker) before updating the
+clock. Together with the \fBtrust\fP option this can be useful to allow a trusted,
+but not very precise, reference clock to be safely combined with
+unauthenticated NTP sources in order to improve the accuracy of the clock. They
+can be selected and used for synchronisation only if they agree with the
+trusted and required source.
+.RE
+.sp
+\fBminsamples\fP \fIsamples\fP
+.RS 4
+Set the minimum number of samples kept for this source. This overrides the
+\fBminsamples\fP directive.
+.RE
+.sp
+\fBmaxsamples\fP \fIsamples\fP
+.RS 4
+Set the maximum number of samples kept for this source. This overrides the
+\fBmaxsamples\fP directive.
+.RE
+.RE
+.sp
+\fBmanual\fP
+.RS 4
+The \fBmanual\fP directive enables support at run\-time for the
+\fBsettime\fP command in \fBchronyc\fP. If no \fBmanual\fP
+directive is included, any attempt to use the \fBsettime\fP command in \fBchronyc\fP
+will be met with an error message.
+.sp
+Note that the \fBsettime\fP command can be enabled at run\-time using
+the \fBmanual\fP command in \fBchronyc\fP. (The idea of the two
+commands is that the \fBmanual\fP command controls the manual clock driver\(cqs
+behaviour, whereas the \fBsettime\fP command allows samples of manually entered
+time to be provided.)
+.RE
+.sp
+\fBacquisitionport\fP \fIport\fP
+.RS 4
+By default, \fBchronyd\fP uses a separate client socket for each configured server
+and their source port is chosen arbitrarily by the operating system. However,
+you can use the \fBacquisitionport\fP directive to explicitly specify a port and
+use only one socket (per IPv4 or IPv6 address family) for all configured servers.
+This can be useful for getting through some firewalls. If set to 0, the source
+port of the socket will be chosen arbitrarily.
+.sp
+It can be set to the same port as is used by the NTP server (which can be
+configured with the \fBport\fP directive) to use only one socket for all
+NTP packets.
+.sp
+An example of the \fBacquisitionport\fP directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+acquisitionport 1123
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+This would change the source port used for client requests to UDP port 1123.
+You could then persuade the firewall administrator to open that port.
+.RE
+.sp
+\fBbindacqaddress\fP \fIaddress\fP
+.RS 4
+The \fBbindacqaddress\fP directive sets the network interface to which
+\fBchronyd\fP will bind its NTP client sockets. The syntax is similar to the
+\fBbindaddress\fP and \fBbindcmdaddress\fP
+directives.
+.sp
+For each of the IPv4 and IPv6 protocols, only one \fBbindacqaddress\fP directive
+can be specified.
+.RE
+.sp
+\fBdumpdir\fP \fIdirectory\fP
+.RS 4
+To compute the rate of gain or loss of time, \fBchronyd\fP has to store a
+measurement history for each of the time sources it uses.
+.sp
+Certain systems (Linux, FreeBSD, NetBSD, Solaris) have operating system support
+for setting the rate of gain or loss to compensate for known errors. (On Mac OS
+X, \fBchronyd\fP must simulate such a capability by periodically slewing the system
+clock forwards or backwards by a suitable amount to compensate for the error
+built up since the previous slew.)
+.sp
+For such systems, it is possible to save the measurement history across
+restarts of \fBchronyd\fP (assuming no changes are made to the system clock
+behaviour whilst it is not running). If this capability is to be used (via the
+\fBdumponexit\fP directive in the configuration file, or the
+\fBdump\fP command in \fBchronyc\fP), the \fBdumpdir\fP directive
+should be used to define the directory where the measurement histories are
+saved.
+.sp
+An example of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+dumpdir @CHRONYVARDIR@
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+A source whose reference ID (the IP address for IPv4 sources) is \fI1.2.3.4\fP
+would have its measurement history saved in the file
+\fI/var/lib/chrony/1.2.3.4.dat\fP.
+.RE
+.sp
+\fBdumponexit\fP
+.RS 4
+If this directive is present, it indicates that \fBchronyd\fP should save the
+measurement history for each of its time sources recorded whenever the program
+exits. (See the \fBdumpdir\fP directive above.)
+.RE
+.sp
+\fBmaxsamples\fP \fIsamples\fP
+.RS 4
+The \fBmaxsamples\fP directive sets the default maximum number of samples that
+\fBchronyd\fP should keep for each source. This setting can be overridden for
+individual sources in the \fBserver\fP and \fBrefclock\fP
+directives. The default value is 0, which disables the configurable limit. The
+useful range is 4 to 64.
+.RE
+.sp
+\fBminsamples\fP \fIsamples\fP
+.RS 4
+The \fBminsamples\fP directive sets the default minimum number of samples that
+\fBchronyd\fP should keep for each source. This setting can be overridden for
+individual sources in the \fBserver\fP and \fBrefclock\fP
+directives. The default value is 0. The useful range is 4 to 64.
+.RE
+.SS "Source selection"
+.sp
+\fBcombinelimit\fP \fIlimit\fP
+.RS 4
+When \fBchronyd\fP has multiple sources available for synchronisation, it has to
+select one source as the synchronisation source. The measured offsets and
+frequencies of the system clock relative to the other sources, however, can be
+combined with the selected source to improve the accuracy of the system clock.
+.sp
+The \fBcombinelimit\fP directive limits which sources are included in the combining
+algorithm. Their synchronisation distance has to be shorter than the distance
+of the selected source multiplied by the value of the limit. Also, their
+measured frequencies have to be close to the frequency of the selected source.
+.sp
+By default, the limit is 3. Setting the limit to 0 effectively disables the
+source combining algorithm and only the selected source will be used to control
+the system clock.
+.RE
+.sp
+\fBmaxdistance\fP \fIdistance\fP
+.RS 4
+The \fBmaxdistance\fP directive sets the maximum allowed root distance of the
+sources to not be rejected by the source selection algorithm. The distance
+includes the accumulated dispersion, which might be large when the source is no
+longer synchronised, and half of the total round\-trip delay to the primary
+source.
+.sp
+By default, the maximum root distance is 3 seconds.
+.sp
+Setting \fBmaxdistance\fP to a larger value can be useful to allow synchronisation
+with a server that only has a very infrequent connection to its sources and can
+accumulate a large dispersion between updates of its clock.
+.RE
+.sp
+\fBminsources\fP \fIsources\fP
+.RS 4
+The \fBminsources\fP directive sets the minimum number of sources that need to be
+considered as selectable in the source selection algorithm before the local
+clock is updated. The default value is 1.
+.sp
+Setting this option to a larger number can be used to improve the reliability.
+More sources will have to agree with each other and the clock will not be
+updated when only one source (which could be serving incorrect time) is
+reachable.
+.RE
+.sp
+\fBreselectdist\fP \fIdistance\fP
+.RS 4
+When \fBchronyd\fP selects a synchronisation source from available sources, it
+will prefer the one with the shortest synchronisation distance. However, to
+avoid frequent reselecting when there are sources with similar distance, a
+fixed distance is added to the distance for sources that are currently not
+selected. This can be set with the \fBreselectdist\fP directive. By default, the
+distance is 100 microseconds.
+.RE
+.sp
+\fBstratumweight\fP \fIdistance\fP
+.RS 4
+The \fBstratumweight\fP directive sets how much distance should be added per
+stratum to the synchronisation distance when \fBchronyd\fP selects the
+synchronisation source from available sources.
+.sp
+By default, the weight is 0.001 seconds. This means that the stratum of the sources
+in the selection process matters only when the differences between the
+distances are in milliseconds.
+.RE
+.SS "System clock"
+.sp
+\fBcorrtimeratio\fP \fIratio\fP
+.RS 4
+When \fBchronyd\fP is slewing the system clock to correct an offset, the rate at
+which it is slewing adds to the frequency error of the clock. On Linux,
+FreeBSD, NetBSD and Solaris this rate can be controlled.
+.sp
+The \fBcorrtimeratio\fP directive sets the ratio between the duration in which the
+clock is slewed for an average correction according to the source history and
+the interval in which the corrections are done (usually the NTP polling
+interval). Corrections larger than the average take less time and smaller
+corrections take more time, the amount of the correction and the correction
+time are inversely proportional.
+.sp
+Increasing \fBcorrtimeratio\fP improves the overall frequency error of the system
+clock, but increases the overall time error as the corrections take longer.
+.sp
+By default, the ratio is set to 3, the time accuracy of the clock is preferred
+over its frequency accuracy.
+.sp
+The maximum allowed slew rate can be set by the \fBmaxslewrate\fP
+directive. The current remaining correction is shown in the
+\fBtracking\fP report as the \fBSystem time\fP value.
+.RE
+.sp
+\fBdriftfile\fP \fIfile\fP
+.RS 4
+One of the main activities of the \fBchronyd\fP program is to work out the rate at
+which the system clock gains or loses time relative to real time.
+.sp
+Whenever \fBchronyd\fP computes a new value of the gain or loss rate, it is desirable
+to record it somewhere. This allows \fBchronyd\fP to begin compensating the system
+clock at that rate whenever it is restarted, even before it has had a chance to
+obtain an equally good estimate of the rate during the new run. (This process
+can take many minutes, at least.)
+.sp
+The \fBdriftfile\fP directive allows a file to be specified into which \fBchronyd\fP
+can store the rate information. Two parameters are recorded in the file. The
+first is the rate at which the system clock gains or loses time, expressed in
+parts per million, with gains positive. Therefore, a value of 100.0 indicates
+that when the system clock has advanced by a second, it has gained 100
+microseconds in reality (so the true time has only advanced by 999900
+microseconds). The second is an estimate of the error bound around the first
+value in which the true rate actually lies.
+.sp
+An example of the driftfile directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+driftfile @CHRONYVARDIR@/drift
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBfallbackdrift\fP \fImin\-interval\fP \fImax\-interval\fP
+.RS 4
+Fallback drifts are long\-term averages of the system clock drift calculated
+over exponentially increasing intervals. They are used when the clock is no
+longer synchronised to avoid quickly drifting away from true time if there was
+a short\-term deviation in the drift before the synchronisation was lost.
+.sp
+The directive specifies the minimum and maximum interval since the last clock
+update to switch between fallback drifts. They are defined as a power of 2 (in
+seconds). The syntax is as follows:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+fallbackdrift 16 19
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+In this example, the minimum interval is 16 (18 hours) and the maximum interval is
+19 (6 days). The system clock frequency will be set to the first fallback 18
+hours after last clock update, to the second after 36 hours, etc. This might be
+a good setting to cover daily and weekly temperature fluctuations.
+.sp
+By default (or if the specified maximum or minimum is 0), no fallbacks are used
+and the clock frequency changes only with new measurements from NTP sources,
+reference clocks, or manual input.
+.RE
+.sp
+\fBleapsecmode\fP \fImode\fP
+.RS 4
+A leap second is an adjustment that is occasionally applied to UTC to keep it
+close to the mean solar time. When a leap second is inserted, the last day of
+June or December has an extra second 23:59:60.
+.sp
+For computer clocks that is a problem. The Unix time is defined as number of
+seconds since 00:00:00 UTC on 1 January 1970 without leap seconds. The system
+clock cannot have time 23:59:60, every minute has 60 seconds and every day has
+86400 seconds by definition. The inserted leap second is skipped and the clock
+is suddenly ahead of UTC by one second. The \fBleapsecmode\fP directive selects how
+that error is corrected. There are four options:
+.sp
+\fBsystem\fP
+.RS 4
+When inserting a leap second, the kernel steps the system clock backwards by
+one second when the clock gets to 00:00:00 UTC. When deleting a leap second, it
+steps forward by one second when the clock gets to 23:59:59 UTC. This is the
+default mode when the system driver supports leap seconds (i.e. on Linux,
+FreeBSD, NetBSD and Solaris).
+.RE
+.sp
+\fBstep\fP
+.RS 4
+This is similar to the \fBsystem\fP mode, except the clock is stepped by
+\fBchronyd\fP instead of the kernel. It can be useful to avoid bugs in the kernel
+code that would be executed in the \fBsystem\fP mode. This is the default mode
+when the system driver does not support leap seconds.
+.RE
+.sp
+\fBslew\fP
+.RS 4
+The clock is corrected by slewing started at 00:00:00 UTC when a leap second
+is inserted or 23:59:59 UTC when a leap second is deleted. This might be
+preferred over the \fBsystem\fP and \fBstep\fP modes when applications running on the
+system are sensitive to jumps in the system time and it is acceptable that the
+clock will be off for a longer time. On Linux with the default
+\fBmaxslewrate\fP value the correction takes 12 seconds.
+.RE
+.sp
+\fBignore\fP
+.RS 4
+No correction is applied to the clock for the leap second. The clock will be
+corrected later in normal operation when new measurements are made and the
+estimated offset includes the one second error.
+.RE
+.RE
+.sp
+
+.RS 4
+.sp
+When serving time to NTP clients that cannot be configured to correct their
+clocks for a leap second by slewing, or to clients that would correct at
+slightly different rates when it is necessary to keep them close together, the
+\fBslew\fP mode can be combined with the \fBsmoothtime\fP directive to
+enable a server leap smear.
+.sp
+When smearing a leap second, the leap status is suppressed on the server and
+the served time is corrected slowly be slewing instead of stepping. The clients
+do not need any special configuration as they do not know there is any leap
+second and they follow the server time which eventually brings them back to
+UTC. Care must be taken to ensure they use only NTP servers which smear the
+leap second in exactly the same way for synchronisation.
+.sp
+This feature must be used carefully, because the server is intentionally not
+serving its best estimate of the true time.
+.sp
+A recommended configuration to enable a server leap smear is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+leapsecmode slew
+maxslewrate 1000
+smoothtime 400 0.001 leaponly
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The first directive is necessary to disable the clock step which would reset
+the smoothing process. The second directive limits the slewing rate of the
+local clock to 1000 ppm, which improves the stability of the smoothing process
+when the local correction starts and ends. The third directive enables the
+server time smoothing process. It will start when the clock gets to 00:00:00
+UTC and it will take 17 hours 34 minutes to finish. The frequency offset will
+be changing by 0.001 ppm per second and will reach a maximum of 31.623 ppm. The
+\fBleaponly\fP option makes the duration of the leap smear constant and allows the
+clients to safely synchronise with multiple identically configured leap
+smearing servers.
+.RE
+.sp
+\fBleapsectz\fP \fItimezone\fP
+.RS 4
+This directive is used to set the name of the timezone in the system tz
+database which \fBchronyd\fP can use to find out when will the next leap second
+occur. It will periodically check if the times 23:59:59 and 23:59:60 are valid
+on Jun 30 and Dec 31 in the timezone. This typically works with the \fBright/UTC\fP
+timezone.
+.sp
+This directive is mainly useful with reference clocks which do not provide
+leap second information. It is not necessary to restart \fBchronyd\fP if the tz
+database is updated with a new leap second at least 12 hours before the event.
+.sp
+An example of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+leapsectz right/UTC
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The following shell command verifies that the timezone contains leap seconds
+and can be used with this directive:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+$ TZ=right/UTC date \-d \(aqDec 31 2008 23:59:60\(aq
+Wed Dec 31 23:59:60 UTC 2008
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBmakestep\fP \fIthreshold\fP \fIlimit\fP
+.RS 4
+Normally \fBchronyd\fP will cause the system to gradually correct any time offset,
+by slowing down or speeding up the clock as required. In certain situations,
+the system clock might be so far adrift that this slewing process would take a
+very long time to correct the system clock.
+.sp
+This directive forces \fBchronyd\fP to step the system clock if the adjustment is
+larger than a threshold value, but only if there were no more clock updates
+since \fBchronyd\fP was started than a specified limit (a negative value can be
+used to disable the limit).
+.sp
+This is particularly useful when using reference clocks, because the
+\fBinitstepslew\fP directive works only with NTP sources.
+.sp
+An example of the use of this directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+makestep 0.1 3
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+This would step the system clock if the adjustment is larger than 0.1 seconds, but
+only in the first three clock updates.
+.RE
+.sp
+\fBmaxchange\fP \fIoffset\fP \fIstart\fP \fIignore\fP
+.RS 4
+This directive sets the maximum allowed offset corrected on a clock update. The
+check is performed only after the specified number of updates to allow a large
+initial adjustment of the system clock. When an offset larger than the
+specified maximum occurs, it will be ignored for the specified number of times
+and then \fBchronyd\fP will give up and exit (a negative value can be used to never
+exit). In both cases a message is sent to syslog.
+.sp
+An example of the use of this directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+maxchange 1000 1 2
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+After the first clock update, \fBchronyd\fP will check the offset on every clock
+update, it will ignore two adjustments larger than 1000 seconds and exit on
+another one.
+.RE
+.sp
+\fBmaxclockerror\fP \fIerror\-in\-ppm\fP
+.RS 4
+The \fBmaxclockerror\fP directive sets the maximum assumed frequency error that the
+system clock can gain on its own between clock updates. It describes the
+stability of the clock.
+.sp
+By default, the maximum error is 1 ppm.
+.sp
+Typical values for \fIerror\-in\-ppm\fP might be 10 for a low quality clock and 0.1
+for a high quality clock using a temperature compensated crystal oscillator.
+.RE
+.sp
+\fBmaxdrift\fP \fIdrift\-in\-ppm\fP
+.RS 4
+This directive specifies the maximum assumed drift (frequency error) of the
+system clock. It limits the frequency adjustment that \fBchronyd\fP is allowed to
+use to correct the measured drift. It is an additional limit to the maximum
+adjustment that can be set by the system driver (100000 ppm on Linux, 500 ppm
+on FreeBSD and NetBSD, 32500 ppm on Solaris).
+.sp
+By default, the maximum assumed drift is 500000 ppm, i.e. the adjustment is
+limited by the system driver rather than this directive.
+.RE
+.sp
+\fBmaxupdateskew\fP \fIskew\-in\-ppm\fP
+.RS 4
+One of \fBchronyd\fP\(cqs tasks is to work out how fast or slow the computer\(cqs clock
+runs relative to its reference sources. In addition, it computes an estimate of
+the error bounds around the estimated value.
+.sp
+If the range of error is too large, it probably indicates that the measurements
+have not settled down yet, and that the estimated gain or loss rate is not very
+reliable.
+.sp
+The \fBmaxupdateskew\fP directive sets the threshold for determining whether an
+estimate might be so unreliable that it should not be used. By default, the
+threshold is 1000 ppm.
+.sp
+Typical values for \fIskew\-in\-ppm\fP might be 100 for a dial\-up connection to
+servers over a phone line, and 5 or 10 for a computer on a LAN.
+.sp
+It should be noted that this is not the only means of protection against using
+unreliable estimates. At all times, \fBchronyd\fP keeps track of both the estimated
+gain or loss rate, and the error bound on the estimate. When a new estimate is
+generated following another measurement from one of the sources, a weighted
+combination algorithm is used to update the master estimate. So if \fBchronyd\fP
+has an existing highly\-reliable master estimate and a new estimate is generated
+which has large error bounds, the existing master estimate will dominate in the
+new master estimate.
+.RE
+.sp
+\fBmaxslewrate\fP \fIrate\-in\-ppm\fP
+.RS 4
+The \fBmaxslewrate\fP directive sets the maximum rate at which \fBchronyd\fP is allowed
+to slew the time. It limits the slew rate controlled by the correction time
+ratio (which can be set by the \fBcorrtimeratio\fP directive) and
+is effective only on systems where \fBchronyd\fP is able to control the rate (i.e.
+Linux, FreeBSD, NetBSD, Solaris).
+.sp
+For each system there is a maximum frequency offset of the clock that
+can be set by the driver. On Linux it is 100000 ppm, on FreeBSD and NetBSD
+it is 5000 ppm, and on Solaris it is 32500 ppm. Also, due to a kernel
+limitation, setting \fBmaxslewrate\fP on FreeBSD and NetBSD to a value between 500
+ppm and 5000 ppm will effectively set it to 500 ppm.
+.sp
+By default, the maximum slew rate is set to 83333.333 ppm (one twelfth).
+.RE
+.sp
+\fBtempcomp\fP \fIfile\fP \fIinterval\fP \fIT0\fP \fIk0\fP \fIk1\fP \fIk2\fP, \fBtempcomp\fP \fIfile\fP \fIinterval\fP \fIpoints\-file\fP
+.RS 4
+Normally, changes in the rate of drift of the system clock are caused mainly by
+changes in the temperature of the crystal oscillator on the motherboard.
+.sp
+If there are temperature measurements available from a sensor close to the
+oscillator, the \fBtempcomp\fP directive can be used to compensate for the changes
+in the temperature and improve the stability and accuracy of the clock.
+.sp
+The result depends on many factors, including the resolution of the sensor, the
+amount of noise in the measurements, the polling interval of the time source,
+the compensation update interval, how well the compensation is specified, and
+how close the sensor is to the oscillator. When it is working well, the
+frequency reported in the \fItracking.log\fP file is more stable and the maximum
+reached offset is smaller.
+.sp
+There are two forms of the directive. The first one has six parameters: a path
+to the file containing the current temperature from the sensor (in text
+format), the compensation update interval (in seconds), and temperature
+coefficients \fIT0\fP, \fIk0\fP, \fIk1\fP, \fIk2\fP.
+.sp
+The frequency compensation is calculated (in ppm) as
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+k0 + (T \- T0) * k1 + (T \- T0)^2 * k2
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The result has to be between \-10 ppm and 10 ppm, otherwise the measurement is
+considered invalid and will be ignored. The \fIk0\fP coefficient can be adjusted to
+keep the compensation in that range.
+.sp
+An example of the use is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+tempcomp /sys/class/hwmon/hwmon0/temp2_input 30 26000 0.0 0.000183 0.0
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The measured temperature will be read from the file in the Linux sysfs
+filesystem every 30 seconds. When the temperature is 26000 (26 degrees
+Celsius), the frequency correction will be zero. When it is 27000 (27 degrees
+Celsius), the clock will be set to run faster by 0.183 ppm, etc.
+.sp
+The second form has three parameters: the path to the sensor file, the update
+interval, and a path to a file containing a list of (temperature, compensation)
+points, from which the compensation is linearly interpolated or extrapolated.
+.sp
+An example is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+tempcomp /sys/class/hwmon/hwmon0/temp2_input 30 /etc/chrony.tempcomp
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+where the \fI/etc/chrony.tempcomp\fP file could have
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+20000 1.0
+21000 0.64
+22000 0.36
+23000 0.16
+24000 0.04
+25000 0.0
+26000 0.04
+27000 0.16
+28000 0.36
+29000 0.64
+30000 1.0
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Valid measurements with corresponding compensations are logged to the
+\fItempcomp.log\fP file if enabled by the \fBlog tempcomp\fP directive.
+.RE
+.SS "NTP server"
+.sp
+\fBallow\fP [\fBall\fP] [\fIsubnet\fP]
+.RS 4
+The \fBallow\fP directive is used to designate a particular subnet from which NTP
+clients are allowed to access the computer as an NTP server.
+.sp
+The default is that no clients are allowed access, i.e. \fBchronyd\fP operates
+purely as an NTP client. If the \fBallow\fP directive is used, \fBchronyd\fP will be
+both a client of its servers, and a server to other clients.
+.sp
+Examples of the use of the directive are as follows:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+allow foo.example.net
+allow 1.2
+allow 3.4.5
+allow 6.7.8/22
+allow 6.7.8.9/22
+allow 2001:db8::/32
+allow 0/0
+allow ::/0
+allow
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The first directive allows the named node to be an NTP client of this computer.
+The second directive allows any node with an IPv4 address of the form \fI1.2.x.y\fP
+(with \fIx\fP and \fIy\fP arbitrary) to be an NTP client of this computer. Likewise,
+the third directive allows any node with an IPv4 address of the form \fI3.4.5.x\fP
+to have client NTP access. The fourth and fifth forms allow access from any
+node with an IPv4 address of the form \fI6.7.8.x\fP, \fI6.7.9.x\fP, \fI6.7.10.x\fP or
+\fI6.7.11.x\fP (with \fIx\fP arbitrary), i.e. the value 22 is the number of bits
+defining the specified subnet. In the fifth form, the final byte is ignored.
+The sixth form is used for IPv6 addresses. The seventh and eighth forms allow
+access by any IPv4 and IPv6 node respectively. The ninth forms allows access by
+any node (IPv4 or IPv6).
+.sp
+A second form of the directive, \fBallow all\fP, has a greater effect, depending on
+the ordering of directives in the configuration file. To illustrate the effect,
+consider the two examples:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+allow 1.2.3.4
+deny 1.2.3
+allow 1.2
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+and
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+allow 1.2.3.4
+deny 1.2.3
+allow all 1.2
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+In the first example, the effect is the same regardless of what order the three
+directives are given in. So the \fI1.2.x.y\fP subnet is allowed access, except for
+the \fI1.2.3.x\fP subnet, which is denied access, however the host \fI1.2.3.4\fP is
+allowed access.
+.sp
+In the second example, the \fBallow all 1.2\fP directives overrides the effect of
+\fIany\fP previous directive relating to a subnet within the specified subnet.
+Within a configuration file this capability is probably rather moot; however,
+it is of greater use for reconfiguration at run\-time via \fBchronyc\fP with the
+\fBallow all\fP command.
+.sp
+Note, if the \fBinitstepslew\fP directive is used in the
+configuration file, each of the computers listed in that directive must allow
+client access by this computer for it to work.
+.RE
+.sp
+\fBdeny\fP [\fBall\fP] [\fIsubnet\fP]
+.RS 4
+This is similar to the \fBallow\fP directive, except that it denies NTP
+client access to a particular subnet or host, rather than allowing it.
+.sp
+The syntax is identical.
+.sp
+There is also a \fBdeny all\fP directive with similar behaviour to the \fBallow all\fP
+directive.
+.RE
+.sp
+\fBbindaddress\fP \fIaddress\fP
+.RS 4
+The \fBbindaddress\fP directive allows you to restrict the network interface to
+which \fBchronyd\fP will listen for NTP requests. This provides an additional level
+of access restriction above that available through the \fBdeny\fP
+mechanism.
+.sp
+Suppose you have a local network with addresses in the \fI192.168.1.0\fP
+subnet together with an Internet connection. The network interface\(cqs IP
+address is \fI192.168.1.1\fP. Suppose you want to block all access through the
+Internet connection. You could add the line:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+bindaddress 192.168.1.1
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+to the configuration file.
+.sp
+For each of the IPv4 and IPv6 protocols, only one \fBbindaddress\fP directive can be
+specified. Therefore, it is not useful on computers which should serve NTP on
+multiple network interfaces.
+.RE
+.sp
+\fBbroadcast\fP \fIinterval\fP \fIaddress\fP [\fIport\fP]
+.RS 4
+The \fBbroadcast\fP directive is used to declare a broadcast address to which
+chronyd should send packets in the NTP broadcast mode (i.e. make \fBchronyd\fP act
+as a broadcast server). Broadcast clients on that subnet will be able to
+synchronise.
+.sp
+The syntax is as follows:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+broadcast 30 192.168.1.255
+broadcast 60 192.168.2.255 12123
+broadcast 60 ff02::101
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+In the first example, the destination port defaults to UDP port 123 (the normal NTP
+port). In the second example, the destination port is specified as 12123. The
+first parameter in each case (30 or 60 respectively) is the interval in seconds
+between broadcast packets being sent. The second parameter in each case is the
+broadcast address to send the packet to. This should correspond to the
+broadcast address of one of the network interfaces on the computer where
+\fBchronyd\fP is running.
+.sp
+You can have more than 1 \fBbroadcast\fP directive if you have more than 1 network
+interface onto which you want to send NTP broadcast packets.
+.sp
+\fBchronyd\fP itself cannot act as a broadcast client; it must always be configured
+as a point\-to\-point client by defining specific NTP servers and peers. This
+broadcast server feature is intended for providing a time source to other NTP
+implementations.
+.sp
+If \fBntpd\fP is used as the broadcast client, it will try to measure the
+round\-trip delay between the server and client with normal client mode packets.
+Thus, the broadcast subnet should also be the subject of an \fBallow\fP
+directive.
+.RE
+.sp
+\fBclientloglimit\fP \fIlimit\fP
+.RS 4
+This directive specifies the maximum amount of memory that \fBchronyd\fP is allowed
+to allocate for logging of client accesses. The default limit is 524288 bytes,
+which allows monitoring of several thousands of addresses at the same time.
+.sp
+In older \fBchrony\fP versions if the limit was set to 0, the memory allocation was
+unlimited.
+.sp
+An example of the use of this directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+clientloglimit 1048576
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBnoclientlog\fP
+.RS 4
+This directive, which takes no arguments, specifies that client accesses are
+not to be logged. Normally they are logged, allowing statistics to be reported
+using the \fBclients\fP command in \fBchronyc\fP.
+.RE
+.sp
+\fBlocal\fP [\fIoption\fP]...
+.RS 4
+The \fBlocal\fP directive enables a local reference mode, which allows \fBchronyd\fP
+operating as an NTP server to appear synchronised to real time (from the
+viewpoint of clients polling it), even when it was never synchronised or
+the last update of the clock happened a long time ago.
+.sp
+This directive is normally used in an isolated network, where computers are
+required to be synchronised to one another, but not necessarily to real time.
+The server can be kept vaguely in line with real time by manual input.
+.sp
+The \fBlocal\fP directive has the following options:
+.sp
+\fBstratum\fP \fIstratum\fP
+.RS 4
+This option sets the stratum of the server which will be reported to clients
+when the local reference is active. The specified value is in the range 1
+through 15, and the default value is 10. It should be larger than the maximum
+expected stratum in the network when external NTP servers are accessible.
+.sp
+Stratum 1 indicates a computer that has a true real\-time reference directly
+connected to it (e.g. GPS, atomic clock, etc.), such computers are expected to
+be very close to real time. Stratum 2 computers are those which have a stratum
+1 server; stratum 3 computers have a stratum 2 server and so on. A value
+of 10 indicates that the clock is so many hops away from a reference clock that
+its time is fairly unreliable.
+.RE
+.sp
+\fBdistance\fP \fIdistance\fP
+.RS 4
+This option sets the threshold for the root distance which will activate the local
+reference. If \fBchronyd\fP was synchronised to some source, the local reference
+will not be activated until its root distance reaches the specified value (the
+rate at which the distance is increasing depends on how well the clock was
+tracking the source). The default value is 1 second.
+.sp
+The current root distance can be calculated from root delay and root dispersion
+(reported by the \fBtracking\fP command in \fBchronyc\fP) as:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+distance = delay / 2 + dispersion
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBorphan\fP
+.RS 4
+This option enables a special \(oqorphan\(cq mode, where sources with stratum equal
+to the local \fIstratum\fP are assumed to not serve real time. They are ignored
+unless no other source is selectable and their reference IDs are smaller than
+the local reference ID.
+.sp
+This allows multiple servers in the network to use the same \fBlocal\fP
+configuration and to be synchronised to one another, without confusing clients
+that poll more than one server. Each server needs to be configured to poll all
+other servers with the \fBlocal\fP directive. This ensures only the server with the
+smallest reference ID has the local reference active and others are
+synchronised to it. When that server fails, another will take over.
+.sp
+The \fBorphan\fP mode is compatible with the \fBntpd\fP\(cqs orphan mode (enabled by the
+\fBtos orphan\fP command).
+.RE
+.RE
+.sp
+
+.RS 4
+.sp
+An example of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+local stratum 10 orphan
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBport\fP \fIport\fP
+.RS 4
+This option allows you to configure the port on which \fBchronyd\fP will listen for
+NTP requests. The port will be open only when an address is allowed by the
+\fBallow\fP directive or the \fBallow\fP command in
+\fBchronyc\fP, an NTP peer is configured, or the broadcast server mode is enabled.
+.sp
+The default value is 123, the standard NTP port. If set to 0, \fBchronyd\fP will
+never open the server port and will operate strictly in a client\-only mode. The
+source port used in NTP client requests can be set by the
+\fBacquisitionport\fP directive.
+.RE
+.sp
+\fBratelimit\fP [\fIoption\fP]...
+.RS 4
+This directive enables response rate limiting for NTP packets. Its purpose is
+to reduce network traffic with misconfigured or broken NTP clients that are
+polling the server too frequently. The limits are applied to individual IP
+addresses. If multiple clients share one IP address (e.g. multiple hosts behind
+NAT), the sum of their traffic will be limited. If a client that increases its
+polling rate when it does not receive a reply is detected, its rate limiting
+will be temporarily suspended to avoid increasing the overall amount of
+traffic. The maximum number of IP addresses which can be monitored at the same
+time depends on the memory limit set by the \fBclientloglimit\fP
+directive.
+.sp
+The \fBratelimit\fP directive supports a number of options (which can be defined
+in any order):
+.sp
+\fBinterval\fP
+.RS 4
+This option sets the minimum interval between responses. It is defined as a
+power of 2 in seconds. The default value is 3 (8 seconds). The minimum value
+is \-4 and the maximum value is 12.
+.RE
+.sp
+\fBburst\fP
+.RS 4
+This option sets the maximum number of responses that can be sent in a burst,
+temporarily exceeding the limit specified by the \fBinterval\fP option. This is
+useful for clients that make rapid measurements on start (e.g. \fBchronyd\fP with
+the \fBiburst\fP option). The default value is 8. The minimum value is 1 and the
+maximum value is 255.
+.RE
+.sp
+\fBleak\fP
+.RS 4
+This option sets the rate at which responses are randomly allowed even if the
+limits specified by the \fBinterval\fP and \fBburst\fP options are exceeded. This is
+necessary to prevent an attacker who is sending requests with a spoofed
+source address from completely blocking responses to that address. The leak
+rate is defined as a power of 1/2 and it is 3 by default, i.e. on average at
+least every eighth request has a response. The minimum value is 1 and the
+maximum value is 4.
+.RE
+.RE
+.sp
+
+.RS 4
+.sp
+An example use of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+ratelimit interval 4 burst 4
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+This would reduce the response rate for IP addresses that send packets on
+average more frequently than once per 16 seconds or send packets in bursts
+of more than 4 packets.
+.RE
+.sp
+\fBsmoothtime\fP \fImax\-freq\fP \fImax\-wander\fP [\fBleaponly\fP]
+.RS 4
+The \fBsmoothtime\fP directive can be used to enable smoothing of the time that
+\fBchronyd\fP serves to its clients to make it easier for them to track it and keep
+their clocks close together even when large offset or frequency corrections are
+applied to the server\(cqs clock, for example after being offline for a longer
+time.
+.sp
+BE WARNED: The server is intentionally not serving its best estimate of the
+true time. If a large offset has been accumulated, it can take a very long time
+to smooth it out. This directive should be used only when the clients are not
+configured to also poll another NTP server, because they could reject this
+server as a falseticker or fail to select a source completely.
+.sp
+The smoothing process is implemented with a quadratic spline function with two
+or three pieces. It is independent from any slewing applied to the local system
+clock, but the accumulated offset and frequency will be reset when the clock is
+corrected by stepping, e.g. by the \fBmakestep\fP directive or the
+\fBmakestep\fP command in \fBchronyc\fP. The process can be
+reset without stepping the clock by the \fBsmoothtime
+reset\fP command.
+.sp
+The first two arguments of the directive are the maximum frequency offset of
+the smoothed time to the tracked NTP time (in ppm) and the maximum rate at
+which the frequency offset is allowed to change (in ppm per second). \fBleaponly\fP
+is an optional third argument which enables a mode where only leap seconds are
+smoothed out and normal offset and frequency changes are ignored. The \fBleaponly\fP
+option is useful in a combination with the \fBleapsecmode slew\fP
+directive to allow the clients to use multiple time smoothing servers safely.
+.sp
+The smoothing process is activated automatically when 1/10000 of the estimated
+skew of the local clock falls below the maximum rate of frequency change. It
+can be also activated manually by the \fBsmoothtime
+activate\fP command, which is particularly useful when the clock is
+synchronised only with manual input and the skew is always larger than the
+threshold. The \fBsmoothing\fP command can be used to
+monitor the process.
+.sp
+An example suitable for clients using \fBntpd\fP and 1024 second polling interval
+could be:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+smoothtime 400 0.001
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+An example suitable for clients using \fBchronyd\fP on Linux could be:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+smoothtime 50000 0.01
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.SS "Command and monitoring access"
+.sp
+\fBbindcmdaddress\fP \fIaddress\fP
+.RS 4
+The \fBbindcmdaddress\fP directive allows you to specify the network interface on
+which \fBchronyd\fP will listen for monitoring command packets (issued by
+\fBchronyc\fP). This provides an additional level of access restriction above that
+available through the \fBcmddeny\fP mechanism.
+.sp
+This directive can also change the path of the Unix domain command socket,
+which is used by \fBchronyc\fP to send configuration commands. The socket must be
+in a directory that is accessible only by the root or \fIchrony\fP user. The
+directory will be created on start if it does not exist. The compiled\-in default
+path of the socket is \fI@CHRONYSOCKDIR@/chronyd.sock\fP.
+.sp
+By default, \fBchronyd\fP binds to the loopback interface (with addresses
+\fI127.0.0.1\fP and \fI::1\fP). This blocks all access except from localhost. To listen
+for command packets on all interfaces, you can add the lines:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+bindcmdaddress 0.0.0.0
+bindcmdaddress ::
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+to the configuration file.
+.sp
+For each of the IPv4 and IPv6 protocols, only one \fBbindcmdaddress\fP directive can be
+specified.
+.sp
+An example that sets the path of the Unix domain command socket is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+bindcmdaddress /var/run/chrony/chronyd.sock
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBcmdallow\fP [\fBall\fP] [\fIsubnet\fP]
+.RS 4
+This is similar to the \fBallow\fP directive, except that it allows
+monitoring access (rather than NTP client access) to a particular subnet or
+host. (By \(oqmonitoring access\(cq is meant that \fBchronyc\fP can be run on those
+hosts and retrieve monitoring data from \fBchronyd\fP on this computer.)
+.sp
+The syntax is identical to the \fBallow\fP directive.
+.sp
+There is also a \fBcmdallow all\fP directive with similar behaviour to the \fBallow
+all\fP directive (but applying to monitoring access in this case, of course).
+.sp
+Note that \fBchronyd\fP has to be configured with the
+\fBbindcmdaddress\fP directive to not listen only on the
+loopback interface to actually allow remote access.
+.RE
+.sp
+\fBcmddeny\fP [\fBall\fP] [\fIsubnet\fP]
+.RS 4
+This is similar to the \fBcmdallow\fP directive, except that it denies
+monitoring access to a particular subnet or host, rather than allowing it.
+.sp
+The syntax is identical.
+.sp
+There is also a \fBcmddeny all\fP directive with similar behaviour to the \fBcmdallow
+all\fP directive.
+.RE
+.sp
+\fBcmdport\fP \fIport\fP
+.RS 4
+The \fBcmdport\fP directive allows the port that is used for run\-time monitoring
+(via the \fBchronyc\fP program) to be altered from its default (323). If set to 0,
+\fBchronyd\fP will not open the port, this is useful to disable \fBchronyc\fP
+access from the Internet. (It does not disable the Unix domain command socket.)
+.sp
+An example shows the syntax:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+cmdport 257
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+This would make \fBchronyd\fP use UDP 257 as its command port. (\fBchronyc\fP would
+need to be run with the \fB\-p 257\fP switch to inter\-operate correctly.)
+.RE
+.sp
+\fBcmdratelimit\fP [\fIoption\fP]...
+.RS 4
+This directive enables response rate limiting for command packets. It is
+similar to the \fBratelimit\fP directive, except responses to
+localhost are never limited and the default interval is 1 (2 seconds), the default
+burst is 16, and the default leak rate is 2.
+.sp
+An example of the use of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+cmdratelimit interval 2
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.SS "Real\-time clock (RTC)"
+.sp
+\fBhwclockfile\fP \fIfile\fP
+.RS 4
+The \fBhwclockfile\fP directive sets the location of the adjtime file which is
+used by the \fBhwclock\fP program on Linux. \fBchronyd\fP parses the file to find out
+if the RTC keeps local time or UTC. It overrides the \fBrtconutc\fP
+directive.
+.sp
+The compiled\-in default value is \(aq\fI@DEFAULT_HWCLOCK_FILE@\fP\(aq.
+.sp
+An example of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+hwclockfile /etc/adjtime
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBrtcautotrim\fP \fIthreshold\fP
+.RS 4
+The \fBrtcautotrim\fP directive is used to keep the RTC close to the system clock
+automatically. When the system clock is synchronised and the estimated error
+between the two clocks is larger than the specified threshold, \fBchronyd\fP will
+trim the RTC as if the \fBtrimrtc\fP command in \fBchronyc\fP
+was issued.
+.sp
+This directive is effective only with the \fBrtcfile\fP directive.
+.sp
+An example of the use of this directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+rtcautotrim 30
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+This would set the threshold error to 30 seconds.
+.RE
+.sp
+\fBrtcdevice\fP \fIdevice\fP
+.RS 4
+The \fBrtcdevice\fP directive sets the path to the device file for accessing the
+RTC. The default path is \fI/dev/rtc\fP.
+.RE
+.sp
+\fBrtcfile\fP \fIfile\fP
+.RS 4
+The \fBrtcfile\fP directive defines the name of the file in which \fBchronyd\fP can
+save parameters associated with tracking the accuracy of the RTC.
+.sp
+An example of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+rtcfile @CHRONYVARDIR@/rtc
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+\fBchronyd\fP saves information in this file when it exits and when the \fBwritertc\fP
+command is issued in \fBchronyc\fP. The information saved is the RTC\(cqs error at
+some epoch, that epoch (in seconds since January 1 1970), and the rate at which
+the RTC gains or loses time.
+.sp
+So far, the support for real\-time clocks is limited; their code is even more
+system\-specific than the rest of the software. You can only use the RTC
+facilities (the \fBrtcfile\fP directive and the \fB\-s\fP command\-line
+option to \fBchronyd\fP) if the following three conditions apply:
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+You are running Linux.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+The kernel is compiled with extended real\-time clock support (i.e. the
+\fI/dev/rtc\fP device is capable of doing useful things).
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+You do not have other applications that need to make use of \fI/dev/rtc\fP at all.
+.RE
+.RE
+.sp
+\fBrtconutc\fP
+.RS 4
+\fBchronyd\fP assumes by default that the RTC keeps local time (including any
+daylight saving changes). This is convenient on PCs running Linux which are
+dual\-booted with Windows.
+.sp
+If you keep the RTC on local time and your computer is off when daylight saving
+(summer time) starts or ends, the computer\(cqs system time will be one hour in
+error when you next boot and start chronyd.
+.sp
+An alternative is for the RTC to keep Universal Coordinated Time (UTC). This
+does not suffer from the 1 hour problem when daylight saving starts or ends.
+.sp
+If the \fBrtconutc\fP directive appears, it means the RTC is required to keep UTC.
+The directive takes no arguments. It is equivalent to specifying the \fB\-u\fP
+switch to the Linux \fBhwclock\fP program.
+.sp
+Note that this setting is overridden when the \fBhwclockfile\fP
+directive is specified.
+.RE
+.sp
+\fBrtcsync\fP
+.RS 4
+The \fBrtcsync\fP directive enables a mode where the system time is periodically
+copied to the RTC and \fBchronyd\fP does not try to track its drift. This directive
+cannot be used with the \fBrtcfile\fP directive.
+.sp
+On Linux, the RTC copy is performed by the kernel every 11 minutes.
+.sp
+On Mac OS X, \fBchronyd\fP will perform the RTC copy every 60 minutes
+when the system clock is in a synchronised state.
+.sp
+On other systems this directive does nothing.
+.RE
+.SS "Logging"
+.sp
+\fBlog\fP [\fIoption\fP]...
+.RS 4
+The \fBlog\fP directive indicates that certain information is to be logged.
+The log files are written to the directory specified by the \fBlogdir\fP
+directive. A banner is periodically written to the files to indicate the
+meanings of the columns.
+.sp
+\fBmeasurements\fP
+.RS 4
+This option logs the raw NTP measurements and related information to a file
+called \fImeasurements.log\fP. An example line (which actually appears as a single
+line in the file) from the log file is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+2015\-10\-13 05:40:50 203.0.113.15 N 2 111 111 1111 10 10 1.0 \(rs
+ \-4.966e\-03 2.296e\-01 1.577e\-05 1.615e\-01 7.446e\-03
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The columns are as follows (the quantities in square brackets are the values
+from the example line above):
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+Date [2015\-10\-13]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+Hour:Minute:Second. Note that the date\-time pair is expressed in UTC, not the
+local time zone. [05:40:50]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+IP address of server or peer from which measurement came [203.0.113.15]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 4.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 4." 4.2
+.\}
+Leap status (\fIN\fP means normal, \fI+\fP means that the last minute of the current
+month has 61 seconds, \fI\-\fP means that the last minute of the month has 59
+seconds, \fI?\fP means the remote computer is not currently synchronised.) [N]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 5.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 5." 4.2
+.\}
+Stratum of remote computer. [2]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 6.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 6." 4.2
+.\}
+RFC 5905 tests 1 through 3 (1=pass, 0=fail) [111]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 7.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 7." 4.2
+.\}
+RFC 5905 tests 5 through 7 (1=pass, 0=fail) [111]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 8.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 8." 4.2
+.\}
+Tests for maximum delay, maximum delay ratio and maximum delay dev ratio,
+against defined parameters, and a test for synchronisation loop (1=pass,
+0=fail) [1111]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 9.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 9." 4.2
+.\}
+Local poll [10]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 10.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 10." 4.2
+.\}
+Remote poll [10]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 11.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 11." 4.2
+.\}
+\(oqScore\(cq (an internal score within each polling level used to decide when to
+increase or decrease the polling level. This is adjusted based on number of
+measurements currently being used for the regression algorithm). [1.0]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 12.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 12." 4.2
+.\}
+The estimated local clock error (\fItheta\fP in RFC 5905). Positive indicates
+that the local clock is slow of the remote source. [\-4.966e\-03]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 13.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 13." 4.2
+.\}
+The peer delay (\fIdelta\fP in RFC 5905). [2.296e\-01]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 14.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 14." 4.2
+.\}
+The peer dispersion (\fIepsilon\fP in RFC 5905). [1.577e\-05]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 15.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 15." 4.2
+.\}
+The root delay (\fIDELTA\fP in RFC 5905). [1.615e\-01]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 16.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 16." 4.2
+.\}
+The root dispersion (\fIEPSILON\fP in RFC 5905). [7.446e\-03]
+.RE
+.RE
+.sp
+\fBstatistics\fP
+.RS 4
+This option logs information about the regression processing to a file called
+\fIstatistics.log\fP. An example line (which actually appears as a single line in
+the file) from the log file is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+2015\-07\-22 05:40:50 203.0.113.15 6.261e\-03 \-3.247e\-03 \(rs
+ 2.220e\-03 1.874e\-06 1.080e\-06 7.8e\-02 16 0 8
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The columns are as follows (the quantities in square brackets are the values
+from the example line above):
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+Date [2015\-07\-22]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+Hour:Minute:Second. Note that the date\-time pair is expressed in
+UTC, not the local time zone. [05:40:50]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+IP address of server or peer from which measurement comes [203.0.113.15]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 4.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 4." 4.2
+.\}
+The estimated standard deviation of the measurements from the source (in
+seconds). [6.261e\-03]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 5.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 5." 4.2
+.\}
+The estimated offset of the source (in seconds, positive means the local
+clock is estimated to be fast, in this case). [\-3.247e\-03]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 6.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 6." 4.2
+.\}
+The estimated standard deviation of the offset estimate (in seconds).
+[2.220e\-03]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 7.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 7." 4.2
+.\}
+The estimated rate at which the local clock is gaining or losing time
+relative to the source (in seconds per second, positive means the local clock
+is gaining). This is relative to the compensation currently being applied to
+the local clock, \fInot\fP to the local clock without any compensation.
+[1.874e\-06]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 8.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 8." 4.2
+.\}
+The estimated error in the rate value (in seconds per second). [1.080e\-06].
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 9.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 9." 4.2
+.\}
+The ratio of |old_rate \- new_rate| / old_rate_error. Large values
+indicate the statistics are not modelling the source very well. [7.8e\-02]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 10.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 10." 4.2
+.\}
+The number of measurements currently being used for the regression
+algorithm. [16]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 11.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 11." 4.2
+.\}
+The new starting index (the oldest sample has index 0; this is the method
+used to prune old samples when it no longer looks like the measurements fit a
+linear model). [0, i.e. no samples discarded this time]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 12.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 12." 4.2
+.\}
+The number of runs. The number of runs of regression residuals with the same
+sign is computed. If this is too small it indicates that the measurements are
+no longer represented well by a linear model and that some older samples need
+to be discarded. The number of runs for the data that is being retained is
+tabulated. Values of approximately half the number of samples are expected.
+[8]
+.RE
+.RE
+.sp
+\fBtracking\fP
+.RS 4
+This option logs changes to the estimate of the system\(cqs gain or loss rate, and
+any slews made, to a file called \fItracking.log\fP. An example line (which
+actually appears as a single line in the file) from the log file is shown
+below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+2015\-02\-23 05:40:50 203.0.113.15 3 340.529 1.606 1.046e\-03 N \(rs
+ 4 6.849e\-03 \-4.670e\-04
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The columns are as follows (the quantities in square brackets are the
+values from the example line above) :
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+Date [2015\-02\-03]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+Hour:Minute:Second. Note that the date\-time pair is expressed in UTC, not the
+local time zone. [05:40:50]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+The IP address of the server or peer to which the local system is synchronised.
+[203.0.113.15]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 4.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 4." 4.2
+.\}
+The stratum of the local system. [3]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 5.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 5." 4.2
+.\}
+The local system frequency (in ppm, positive means the local system runs fast
+of UTC). [340.529]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 6.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 6." 4.2
+.\}
+The error bounds on the frequency (in ppm). [1.606]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 7.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 7." 4.2
+.\}
+The estimated local offset at the epoch (which is rapidly corrected by
+slewing the local clock. (In seconds, positive indicates the local system
+is fast of UTC). [1.046e\-3]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 8.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 8." 4.2
+.\}
+Leap status (\fIN\fP means normal, \fI+\fP means that the last minute of this month
+has 61 seconds, \fI\-\fP means that the last minute of the month has 59 seconds,
+\fI?\fP means the clock is not currently synchronised.) [N]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 9.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 9." 4.2
+.\}
+The number of combined sources. [4]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 10.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 10." 4.2
+.\}
+The estimated standard deviation of the combined offset (in seconds).
+[6.849e\-03]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 11.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 11." 4.2
+.\}
+The remaining offset correction from the previous update (in seconds,
+positive means the system clock is slow of UTC). [\-4.670e\-04]
+.RE
+.RE
+.sp
+\fBrtc\fP
+.RS 4
+This option logs information about the system\(cqs real\-time clock. An example
+line (which actually appears as a single line in the file) from the \fIrtc.log\fP
+file is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+2015\-07\-22 05:40:50 \-0.037360 1 \-0.037434\(rs
+ \-37.948 12 5 120
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The columns are as follows (the quantities in square brackets are the
+values from the example line above):
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+Date [2015\-07\-22]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+Hour:Minute:Second. Note that the date\-time pair is expressed in UTC, not the
+local time zone. [05:40:50]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+The measured offset between the RTC and the system clock in seconds.
+Positive indicates that the RTC is fast of the system time [\-0.037360].
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 4.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 4." 4.2
+.\}
+Flag indicating whether the regression has produced valid coefficients.
+(1 for yes, 0 for no). [1]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 5.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 5." 4.2
+.\}
+Offset at the current time predicted by the regression process. A large
+difference between this value and the measured offset tends to indicate that
+the measurement is an outlier with a serious measurement error. [\-0.037434]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 6.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 6." 4.2
+.\}
+The rate at which the RTC is losing or gaining time relative to the system
+clock. In ppm, with positive indicating that the RTC is gaining time.
+[\-37.948]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 7.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 7." 4.2
+.\}
+The number of measurements used in the regression. [12]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 8.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 8." 4.2
+.\}
+The number of runs of regression residuals of the same sign. Low values
+indicate that a straight line is no longer a good model of the measured data
+and that older measurements should be discarded. [5]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 9.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 9." 4.2
+.\}
+The measurement interval used prior to the measurement being made (in
+seconds). [120]
+.RE
+.RE
+.sp
+\fBrefclocks\fP
+.RS 4
+This option logs the raw and filtered reference clock measurements to a file
+called \fIrefclocks.log\fP. An example line (which actually appears as a single
+line in the file) from the log file is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+2009\-11\-30 14:33:27.000000 PPS2 7 N 1 4.900000e\-07 \-6.741777e\-07 1.000e\-06
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The columns are as follows (the quantities in square brackets are the values
+from the example line above):
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+Date [2009\-11\-30]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+Hour:Minute:Second.Microsecond. Note that the date\-time pair is expressed in
+UTC, not the local time zone. [14:33:27.000000]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+Reference ID of the reference clock from which the measurement came. [PPS2]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 4.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 4." 4.2
+.\}
+Sequence number of driver poll within one polling interval for raw samples,
+or \fI\-\fP for filtered samples. [7]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 5.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 5." 4.2
+.\}
+Leap status (\fIN\fP means normal, \fI+\fP means that the last minute of the current
+month has 61 seconds, \fI\-\fP means that the last minute of the month has 59
+seconds). [N]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 6.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 6." 4.2
+.\}
+Flag indicating whether the sample comes from PPS source. (1 for yes,
+0 for no, or \fI\-\fP for filtered sample). [1]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 7.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 7." 4.2
+.\}
+Local clock error measured by reference clock driver, or \fI\-\fP for filtered sample.
+[4.900000e\-07]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 8.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 8." 4.2
+.\}
+Local clock error with applied corrections. Positive indicates that the local
+clock is slow. [\-6.741777e\-07]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 9.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 9." 4.2
+.\}
+Assumed dispersion of the sample. [1.000e\-06]
+.RE
+.RE
+.sp
+\fBtempcomp\fP
+.RS 4
+This option logs the temperature measurements and system rate compensations to
+a file called \fItempcomp.log\fP. An example line (which actually appears as a
+single line in the file) from the log file is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+2015\-04\-19 10:39:48 2.8000e+04 3.6600e\-01
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The columns are as follows (the quantities in square brackets are the values
+from the example line above):
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+Date [2015\-04\-19]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+Hour:Minute:Second. Note that the date\-time pair is expressed in UTC, not the
+local time zone. [10:39:48]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+Temperature read from the sensor. [2.8000e+04]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 4.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 4." 4.2
+.\}
+Applied compensation in ppm, positive means the system clock is running
+faster than it would be without the compensation. [3.6600e\-01]
+.RE
+.RE
+.RE
+.sp
+
+.RS 4
+An example of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+log measurements statistics tracking
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBlogbanner\fP \fIentries\fP
+.RS 4
+A banner is periodically written to the log files enabled by the \fBlog\fP
+directive to indicate the meanings of the columns.
+.sp
+The \fBlogbanner\fP directive specifies after how many entries in the log file
+should be the banner written. The default is 32, and 0 can be used to disable
+it entirely.
+.RE
+.sp
+\fBlogchange\fP \fIthreshold\fP
+.RS 4
+This directive sets the threshold for the adjustment of the system clock that
+will generate a syslog message. Clock errors detected via NTP packets,
+reference clocks, or timestamps entered via the
+\fBsettime\fP command of \fBchronyc\fP are logged.
+.sp
+By default, the threshold is 1 second.
+.sp
+An example of the use is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+logchange 0.1
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+which would cause a syslog message to be generated if a system clock error of over
+0.1 seconds starts to be compensated.
+.RE
+.sp
+\fBlogdir\fP \fIdirectory\fP
+.RS 4
+This directive allows the directory where log files are written to be
+specified.
+.sp
+An example of the use of this directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+logdir /var/log/chrony
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBmailonchange\fP \fIemail\fP \fIthreshold\fP
+.RS 4
+This directive defines an email address to which mail should be sent if
+\fBchronyd\fP applies a correction exceeding a particular threshold to the system
+clock.
+.sp
+An example of the use of this directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+mailonchange root@localhost 0.5
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+This would send a mail message to root if a change of more than 0.5 seconds
+were applied to the system clock.
+.sp
+This directive cannot be used when a system call filter is enabled by the \fB\-F\fP
+option as the \fBchronyd\fP process will not be allowed to fork and execute the
+sendmail binary.
+.RE
+.SS "Miscellaneous"
+.sp
+\fBinclude\fP \fIpattern\fP
+.RS 4
+The \fBinclude\fP directive includes a configuration file or multiple configuration
+files if a wildcard pattern is specified. This can be useful when maintaining
+configuration on multiple hosts to keep the differences in separate files.
+.sp
+An example of the directive is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+include @SYSCONFDIR@/chrony.d/*.conf
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBkeyfile\fP \fIfile\fP
+.RS 4
+This directive is used to specify the location of the file containing ID\-key
+pairs for authentication of NTP packets.
+.sp
+The format of the directive is shown in the example below:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+keyfile @SYSCONFDIR@/chrony.keys
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The argument is simply the name of the file containing the ID\-key pairs. The
+format of the file is shown below:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+10 tulip
+11 hyacinth
+20 MD5 ASCII:crocus
+25 SHA1 HEX:1dc764e0791b11fa67efc7ecbc4b0d73f68a070c
+ ...
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Each line consists of an ID, name of an authentication hash function (optional),
+and a password. The ID can be any unsigned integer in the range 1 through
+2^32\-1. The default hash function is \fBMD5\fP. Depending on how \fBchronyd\fP
+was compiled, other supported functions might be \fBSHA1\fP, \fBSHA256\fP, \fBSHA384\fP,
+\fBSHA512\fP, \fBRMD128\fP, \fBRMD160\fP, \fBRMD256\fP, \fBRMD320\fP, \fBTIGER\fP, and \fBWHIRLPOOL\fP. The
+password can be specified as a string of characters not containing white space
+with an optional \fBASCII:\fP prefix, or as a hexadecimal number with the \fBHEX:\fP
+prefix. The maximum length of the line is 2047 characters.
+.sp
+The password is used with the hash function to generate and verify a message
+authentication code (MAC) in NTP packets. It is recommended to use SHA1, or
+stronger, hash function with random passwords specified in the hexadecimal
+format that have at least 128 bits. \fBchronyd\fP will log a warning to
+syslog on start if a source is specified in the configuration file with a key
+that has password shorter than 80 bits.
+.sp
+The \fBkeygen\fP command of \fBchronyc\fP can be used to
+generate random keys for the key file. By default, it generates 160\-bit MD5 or
+SHA1 keys.
+.RE
+.sp
+\fBlock_all\fP
+.RS 4
+The \fBlock_all\fP directive will lock chronyd into RAM so that it will never be
+paged out. This mode is only supported on Linux. This directive uses the Linux
+\fBmlockall()\fP system call to prevent \fBchronyd\fP from ever being swapped out. This
+should result in lower and more consistent latency. It should not have
+significant impact on performance as \fBchronyd\(cqs\fP memory usage is modest. The
+\fBmlockall(2)\fP man page has more details.
+.RE
+.sp
+\fBpidfile\fP \fIfile\fP
+.RS 4
+\fBchronyd\fP always writes its process ID (PID) to a file, and checks this file on
+startup to see if another \fBchronyd\fP may already be running on the system. By
+default, the file used is \fI/var/run/chronyd.pid\fP. The \fBpidfile\fP directive
+allows the name to be changed, e.g.:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+pidfile /run/chronyd.pid
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBsched_priority\fP \fIpriority\fP
+.RS 4
+On Linux, the \fBsched_priority\fP directive will select the SCHED_FIFO real\-time
+scheduler at the specified priority (which must be between 0 and 100). On Mac
+OS X, this option must have either a value of 0 (the default) to disable the
+thread time constraint policy or 1 for the policy to be enabled. Other systems
+do not support this option.
+.sp
+On Linux, this directive uses the \fBsched_setscheduler()\fP system call to
+instruct the kernel to use the SCHED_FIFO first\-in, first\-out real\-time
+scheduling policy for \fBchronyd\fP with the specified priority. This means that
+whenever \fBchronyd\fP is ready to run it will run, interrupting whatever else is
+running unless it is a higher priority real\-time process. This should not
+impact performance as \fBchronyd\fP resource requirements are modest, but it should
+result in lower and more consistent latency since \fBchronyd\fP will not need to
+wait for the scheduler to get around to running it. You should not use this
+unless you really need it. The \fBsched_setscheduler(2)\fP man page has more
+details.
+.sp
+On Mac OS X, this directive uses the \fBthread_policy_set()\fP kernel call to
+specify real\-time scheduling. As noted for Linux, you should not use this
+directive unless you really need it.
+.RE
+.sp
+\fBuser\fP \fIuser\fP
+.RS 4
+The \fBuser\fP directive sets the name of the system user to which \fBchronyd\fP will
+switch after start in order to drop root privileges.
+.sp
+On Linux, \fBchronyd\fP needs to be compiled with support for the \fBlibcap\fP library.
+On Mac OS X, FreeBSD, NetBSD and Solaris \fBchronyd\fP forks into two processes.
+The child process retains root privileges, but can only perform a very limited
+range of privileged system calls on behalf of the parent.
+.sp
+The compiled\-in default value is \fI@DEFAULT_USER@\fP.
+.RE
+.SH "EXAMPLES"
+.SS "NTP client with permanent connection to NTP servers"
+.sp
+This section shows how to configure \fBchronyd\fP for computers that are connected
+to the Internet (or to any network containing true NTP servers which ultimately
+derive their time from a reference clock) permanently or most of the time.
+.sp
+To operate in this mode, you will need to know the names of the NTP servers
+you want to use. You might be able to find names of suitable servers by one of
+the following methods:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Your institution might already operate servers on its network.
+Contact your system administrator to find out.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Your ISP probably has one or more NTP servers available for its
+customers.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Somewhere under the NTP homepage there is a list of public
+stratum 1 and stratum 2 servers. You should find one or more servers that are
+near to you. Check that their access policy allows you to use their
+facilities.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Use public servers from the \c
+.URL "http://www.pool.ntp.org/" "pool.ntp.org" " "
+project.
+.RE
+.sp
+Assuming that your NTP servers are called \fIfoo.example.net\fP, \fIbar.example.net\fP
+and \fIbaz.example.net\fP, your \fIchrony.conf\fP file could contain as a minimum:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+server foo.example.net
+server bar.example.net
+server baz.example.net
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+However, you will probably want to include some of the other directives. The
+\fBdriftfile\fP, \fBmakestep\fP and \fBrtcsync\fP
+might be particularly useful. Also, the \fBiburst\fP option of the
+\fBserver\fP directive is useful to speed up the initial
+synchronisation. The smallest useful configuration file would look something
+like:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+server foo.example.net iburst
+server bar.example.net iburst
+server baz.example.net iburst
+driftfile @CHRONYVARDIR@/drift
+makestep 1.0 3
+rtcsync
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+When using a pool of NTP servers (one name is used for multiple servers which
+might change over time), it is better to specify them with the \fBpool\fP
+directive instead of multiple \fBserver\fP directives. The configuration file could
+in this case look like:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+pool pool.ntp.org iburst
+driftfile @CHRONYVARDIR@/drift
+makestep 1.0 3
+rtcsync
+.fi
+.if n \{\
+.RE
+.\}
+.SS "NTP client with infrequent connection to NTP servers"
+.sp
+This section shows how to configure \fBchronyd\fP for computers that have
+occasional connections to NTP servers. In this case, you will need some
+additional configuration to tell \fBchronyd\fP when the connection goes up and
+down. This saves the program from continuously trying to poll the servers when
+they are inaccessible.
+.sp
+Again, assuming that your NTP servers are called \fIfoo.example.net\fP,
+\fIbar.example.net\fP and \fIbaz.example.net\fP, your \fIchrony.conf\fP file would now
+contain:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+server foo.example.net offline
+server bar.example.net offline
+server baz.example.net offline
+driftfile @CHRONYVARDIR@/drift
+makestep 1.0 3
+rtcsync
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The \fBoffline\fP keyword indicates that the servers start in an offline state, and
+that they should not be contacted until \fBchronyd\fP receives notification from
+\fBchronyc\fP that the link to the Internet is present. To tell \fBchronyd\fP when to
+start and finish sampling the servers, the \fBonline\fP and
+\fBoffline\fP commands of \fBchronyc\fP need to be used.
+.sp
+To give an example of their use, assuming that \fBpppd\fP is the program being
+used to connect to the Internet and that \fBchronyc\fP has been installed at
+\fI@BINDIR@/chronyc\fP, the script \fI/etc/ppp/ip\-up\fP would include:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+@BINDIR@/chronyc online
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+and the script \fI/etc/ppp/ip\-down\fP would include:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+@BINDIR@/chronyc offline
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+\fBchronyd\fP\(cqs polling of the servers would now only occur whilst the machine is
+actually connected to the Internet.
+.SS "Isolated networks"
+.sp
+This section shows how to configure \fBchronyd\fP for computers that never have
+network conectivity to any computer which ultimately derives its time from a
+reference clock.
+.sp
+In this situation, one computer is selected to be the master timeserver. The
+other computers are either direct clients of the master, or clients of clients.
+.sp
+The \fBlocal\fP directive enables a local reference mode, which allows
+\fBchronyd\fP to appear synchronised even when it is not.
+.sp
+The rate value in the master\(cqs drift file needs to be set to the average rate
+at which the master gains or loses time. \fBchronyd\fP includes support for this,
+in the form of the \fBmanual\fP directive and the
+\fBsettime\fP command in the \fBchronyc\fP program.
+.sp
+If the master is rebooted, \fBchronyd\fP can re\-read the drift rate from the drift
+file. However, the master has no accurate estimate of the current time. To get
+around this, the system can be configured so that the master can initially set
+itself to a \(oqmajority\-vote\(cq of selected clients\(aq times; this allows the
+clients to \(oqflywheel\(cq the master while it is rebooting.
+.sp
+The \fBsmoothtime\fP directive is useful when the clocks of the
+clients need to stay close together when the local time is adjusted by the
+\fBsettime\fP command. The smoothing process needs to be
+activated by the \fBsmoothtime activate\fP command when
+the local time is ready to be served. After that point, any adjustments will be
+smoothed out.
+.sp
+A typical configuration file for the master (called \fImaster\fP) might be
+(assuming the clients and the master are in the \fI192.168.165.x\fP subnet):
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+initstepslew 1 client1 client3 client6
+driftfile @CHRONYVARDIR@/drift
+local stratum 8
+manual
+allow 192.168.165.0/24
+smoothtime 400 0.01
+rtcsync
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+For the clients that have to resynchronise the master when it restarts,
+the configuration file might be:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+server master iburst
+driftfile @CHRONYVARDIR@/drift
+allow 192.168.165.0/24
+makestep 1.0 3
+rtcsync
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The rest of the clients would be the same, except that the \fBallow\fP directive is
+not required.
+.sp
+If there is no suitable computer to be designated as the master, or there is a
+requirement to keep the clients synchronised even when it fails, the \fBorphan\fP
+option of the \fBlocal\fP directive enables a special mode where the master is
+selected from multiple computers automatically. They all need to use the same
+\fBlocal\fP configuration and poll one another. The server with the smallest
+reference ID (which is based on its IP address) will take the role of the
+master and others will be synchronised to it. When it fails, the server with
+the second smallest reference ID will take over and so on.
+.sp
+A configuration file for the first server might be (assuming there are three
+servers called \fImaster1\fP, \fImaster2\fP, and \fImaster3\fP):
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+initstepslew 1 master2 master3
+server master2
+server master3
+driftfile @CHRONYVARDIR@/drift
+local stratum 8 orphan
+manual
+allow 192.168.165.0/24
+rtcsync
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The other servers would be the same, except the hostnames in the \fBinitstepslew\fP
+and \fBserver\fP directives would be modified to specify the other servers. Their
+clients might be configured to poll all three servers.
+.SS "RTC tracking"
+.sp
+This section considers a computer which has occasional connections to the
+Internet and is turned off between \(oqsessions\(cq. In this case, \fBchronyd\fP relies
+on the computer\(cqs RTC to maintain the time between the periods when it is
+powered up. It assumes that Linux is run exclusively on the computer. Dual\-boot
+systems might work; it depends what (if anything) the other system does to the
+RTC. On 2.6 and later kernels, if your motherboard has a HPET, you will need to
+enable the \fBHPET_EMULATE_RTC\fP option in your kernel configuration. Otherwise,
+\fBchronyd\fP will not be able to interact with the RTC device and will give up
+using it.
+.sp
+When the computer is connected to the Internet, \fBchronyd\fP has access to
+external NTP servers which it makes measurements from. These measurements are
+saved, and straight\-line fits are performed on them to provide an estimate of
+the computer\(cqs time error and rate of gaining or losing time.
+.sp
+When the computer is taken offline from the Internet, the best estimate of the
+gain or loss rate is used to free\-run the computer until it next goes online.
+.sp
+Whilst the computer is running, \fBchronyd\fP makes measurements of the RTC (via
+the \fI/dev/rtc\fP interface, which must be compiled into the kernel). An estimate
+is made of the RTC error at a particular RTC second, and the rate at which the
+RTC gains or loses time relative to true time.
+.sp
+When the computer is powered down, the measurement histories for all the NTP
+servers are saved to files (if the \fBdumponexit\fP directive is
+specified in the configuration file), and the RTC tracking information is also
+saved to a file (if the \fBrtcfile\fP directive has been specified).
+These pieces of information are also saved if the \fBdump\fP
+and \fBwritertc\fP commands respectively are issued
+through \fBchronyc\fP.
+.sp
+When the computer is rebooted, \fBchronyd\fP reads the current RTC time and the RTC
+information saved at the last shutdown. This information is used to set the
+system clock to the best estimate of what its time would have been now, had it
+been left running continuously. The measurement histories for the servers are
+then reloaded.
+.sp
+The next time the computer goes online, the previous sessions\(aq measurements can
+contribute to the line\-fitting process, which gives a much better estimate of
+the computer\(cqs gain or loss rate.
+.sp
+One problem with saving the measurements and RTC data when the machine is shut
+down is what happens if there is a power failure; the most recent data will not
+be saved. Although \fBchronyd\fP is robust enough to cope with this, some
+performance might be lost. (The main danger arises if the RTC has been changed
+during the session, with the \fBtrimrtc\fP command in \fBchronyc\fP. Because of this,
+\fBtrimrtc\fP will make sure that a meaningful RTC file is saved after the
+change is completed).
+.sp
+The easiest protection against power failure is to put the \fBdump\fP and
+\fBwritertc\fP commands in the same place as the \fBoffline\fP command is issued to
+take \fBchronyd\fP offline; because \fBchronyd\fP free\-runs between online sessions, no
+parameters will change significantly between going offline from the Internet
+and any power failure.
+.sp
+A final point regards computers which are left running for extended periods and
+where it is desired to spin down the hard disc when it is not in use (e.g. when
+not accessed for 15 minutes). \fBchronyd\fP has been planned so it supports such
+operation; this is the reason why the RTC tracking parameters are not saved to
+disc after every update, but only when the user requests such a write, or
+during the shutdown sequence. The only other facility that will generate
+periodic writes to the disc is the \fBlog rtc\fP facility in the configuration
+file; this option should not be used if you want your disc to spin down.
+.sp
+To illustrate how a computer might be configured for this case, example
+configuration files are shown.
+.sp
+For the \fIchrony.conf\fP file, the following can be used as an example.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+server foo.example.net maxdelay 0.4 offline
+server bar.example.net maxdelay 0.4 offline
+server baz.example.net maxdelay 0.4 offline
+logdir /var/log/chrony
+log statistics measurements tracking
+driftfile @CHRONYVARDIR@/drift
+makestep 1.0 3
+maxupdateskew 100.0
+dumponexit
+dumpdir @CHRONYVARDIR@
+rtcfile @CHRONYVARDIR@/rtc
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+\fBpppd\fP is used for connecting to the Internet. This runs two scripts
+\fI/etc/ppp/ip\-up\fP and \fI/etc/ppp/ip\-down\fP when the link goes online and offline
+respectively.
+.sp
+The relevant part of the \fI/etc/ppp/ip\-up\fP file is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+@BINDIR@/chronyc online
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+and the relevant part of the \fI/etc/ppp/ip\-down\fP script is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+@BINDIR@/chronyc \-m offline dump writertc
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+\fBchronyd\fP is started during the boot sequence with the \fB\-r\fP and \fB\-s\fP options.
+It might need to be started before any software that depends on the system clock
+not jumping or moving backwards, depending on the directives in \fBchronyd\fP\(cqs
+configuration file.
+.sp
+For the system shutdown, \fBchronyd\fP should receive a SIGTERM several seconds
+before the final SIGKILL; the SIGTERM causes the measurement histories and RTC
+information to be saved.
+.SH "SEE ALSO"
+.sp
+\fBchronyc(1)\fP, \fBchronyd(8)\fP
+.SH "BUGS"
+.sp
+For instructions on how to report bugs, please visit
+.URL "https://chrony.tuxfamily.org/" "" "."
+.SH "AUTHORS"
+.sp
+chrony was written by Richard Curnow, Miroslav Lichvar, and others. \ No newline at end of file
diff --git a/doc/chronyc.adoc b/doc/chronyc.adoc
new file mode 100644
index 0000000..27574ed
--- /dev/null
+++ b/doc/chronyc.adoc
@@ -0,0 +1,1126 @@
+// This file is part of chrony
+//
+// Copyright (C) Richard P. Curnow 1997-2003
+// Copyright (C) Miroslav Lichvar 2009-2016
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of version 2 of the GNU General Public License as
+// published by the Free Software Foundation.
+//
+// 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+= chronyc(1)
+:doctype: manpage
+:man manual: User manual
+:man source: chrony @CHRONY_VERSION@
+
+== NAME
+
+chronyc - command-line interface for chrony daemon
+
+== SYNOPSIS
+
+*chronyc* [_OPTION_]... [_COMMAND_]...
+
+== DESCRIPTION
+
+*chronyc* is a command-line interface program which can be used to monitor
+*chronyd*'s performance and to change various operating parameters whilst it is
+running.
+
+If no commands are specified on the command line, *chronyc* will expect input
+from the user. The prompt _chronyc>_ will be displayed when it is being run
+from a terminal. If *chronyc*'s input or output are redirected from or to a file,
+the prompt is not shown.
+
+There are two ways *chronyc* can access *chronyd*. One is the Internet
+Protocol (IPv4 or IPv6) and the other is a Unix domain socket, which is
+accessible locally by the root or _chrony_ user. By default, *chronyc* first
+tries to connect to the Unix domain socket. The compiled-in default path is
+_@CHRONYSOCKDIR@/chronyd.sock_. If that fails (e.g. because *chronyc* is
+running under a non-root user), it will try to connect to 127.0.0.1 and then
+::1.
+
+Only the following monitoring commands, which do not affect the behaviour of
+*chronyd*, are allowed from the network: *activity*, *manual list*,
+*rtcdata*, *smoothing*, *sources*, *sourcestats*, *tracking*, *waitsync*. The
+set of hosts from which *chronyd* will accept these commands can be configured
+with the <<chrony.conf.adoc#cmdallow,*cmdallow*>> directive in the *chronyd*'s
+configuration file or the <<cmdallow,*cmdallow*>> command in *chronyc*. By
+default, the commands are accepted only from localhost (127.0.0.1 or ::1).
+
+All other commands are allowed only through the Unix domain socket. When sent
+over the network, *chronyd* will respond with a '`Not authorised`' error, even
+if it is from localhost. In chrony versions before 2.2 they were allowed
+from the network if they were authenticated with a password, but that is no
+longer supported.
+
+Having full access to *chronyd* via *chronyc* is more or less equivalent to
+being able to modify the *chronyd*'s configuration file and restart it.
+
+== OPTIONS
+
+*-4*::
+With this option hostnames will be resolved only to IPv4 addresses.
+
+*-6*::
+With this option hostnames will be resolved only to IPv6 addresses.
+
+*-n*::
+This option disables resolving of IP addresses to hostnames (e.g. to avoid slow
+DNS lookups).
+
+*-c*::
+This option enables printing of reports in a comma-separated values (CSV)
+format. IP addresses will not be resolved to hostnames, time will be printed as
+number of seconds since the epoch and values in seconds will not be converted
+to other units.
+
+*-d*::
+This option enables printing of debugging messages if *chronyc* was compiled
+with debugging support.
+
+*-m*::
+Normally, all arguments on the command line are interpreted as one command.
+With this option multiple commands can be specified. Each argument will be
+interpreted as a whole command.
+
+*-h* _host_::
+This option allows the user to specify which host (or comma-separated list of
+addresses) running the *chronyd* program is to be contacted. This allows for
+remote monitoring, without having to connect over SSH to the other host first.
++
+The default is to contact *chronyd* running on the same host where
+*chronyc* is being run.
+
+*-p* _port_::
+This option allows the user to specify the UDP port number which the target
+*chronyd* is using for its monitoring connections. This defaults to 323; there
+would rarely be a need to change this.
+
+*-f* _file_::
+This option is ignored and is provided only for compatibility.
+
+*-a*::
+This option is ignored and is provided only for compatibility.
+
+*-v*::
+With this option *chronyc* displays its version number on the terminal and
+exits.
+
+== COMMANDS
+
+This section describes each of the commands available within the *chronyc*
+program.
+
+=== System clock
+
+[[tracking]]*tracking*::
+The *tracking* command displays parameters about the system's clock
+performance. An example of the output is shown below.
++
+----
+Reference ID : 203.0.113.15 (foo.example.net)
+Stratum : 3
+Ref time (UTC) : Fri Feb 3 15:00:29 2012
+System time : 0.000001501 seconds slow of NTP time
+Last offset : -0.000001632 seconds
+RMS offset : 0.000002360 seconds
+Frequency : 331.898 ppm fast
+Residual freq : 0.004 ppm
+Skew : 0.154 ppm
+Root delay : 0.373169 seconds
+Root dispersion : 0.024780 seconds
+Update interval : 64.2 seconds
+Leap status : Normal
+----
++
+The fields are explained as follows:
++
+*Reference ID*:::
+This is the reference ID and name (or IP address) of the server to which the
+computer is currently synchronised. For IPv4 addresses, the reference ID is
+equal to the address and for IPv6 addresses it is the first 32 bits of the MD5
+sum of the address.
++
+If it is _127.127.1.1_ it means the computer is not synchronised to any
+external source and that you have the _local_ mode operating (via the
+<<local,*local*>> command in *chronyc*, or the
+<<chrony.conf.adoc#local,*local*>> directive in the configuration file).
+*Stratum*:::
+The stratum indicates how many hops away from a computer with an attached
+reference clock we are. Such a computer is a stratum-1 computer, so the
+computer in the example is two hops away (i.e. _foo.example.net_ is a
+stratum-2 and is synchronised from a stratum-1).
+*Ref time*:::
+This is the time (UTC) at which the last measurement from the reference
+source was processed.
+*System time*:::
+In normal operation, *chronyd* by default never steps the system clock, because
+any jump in the time can have adverse consequences for certain application
+programs. Instead, any error in the system clock is corrected by slightly
+speeding up or slowing down the system clock until the error has been removed,
+and then returning to the system clock's normal speed. A consequence of this is
+that there will be a period when the system clock (as read by other programs)
+will be different from *chronyd*'s estimate of the current true time (which it
+reports to NTP clients when it is operating in server mode). The value reported
+on this line is the difference due to this effect.
+*Last offset*:::
+This is the estimated local offset on the last clock update.
+*RMS offset*:::
+This is a long-term average of the offset value.
+*Frequency*:::
+The '`frequency`' is the rate by which the system's clock would be wrong if
+*chronyd* was not correcting it. It is expressed in ppm (parts per million).
+For example, a value of 1 ppm would mean that when the system's clock thinks it
+has advanced 1 second, it has actually advanced by 1.000001 seconds relative to
+true time.
++
+As you can see in the example, the clock in the computer is not a very
+good one; it would gain about 30 seconds per day if it was not corrected!
+*Residual freq*:::
+This shows the '`residual frequency`' for the currently selected reference
+source. This reflects any difference between what the measurements from the
+reference source indicate the frequency should be and the frequency currently
+being used.
++
+The reason this is not always zero is that a smoothing procedure is
+applied to the frequency. Each time a measurement from the reference
+source is obtained and a new residual frequency computed, the estimated
+accuracy of this residual is compared with the estimated accuracy (see
+'`skew`' next) of the existing frequency value. A weighted average is
+computed for the new frequency, with weights depending on these accuracies.
+If the measurements from the reference source follow a consistent trend, the
+residual will be driven to zero over time.
+*Skew*:::
+This is the estimated error bound on the frequency.
+*Root delay*:::
+This is the total of the network path delays to the stratum-1 computer from
+which the computer is ultimately synchronised.
+*Root dispersion*:::
+This is the total dispersion accumulated through all the computers back to
+the stratum-1 computer from which the computer is ultimately synchronised.
+Dispersion is due to system clock resolution, statistical measurement
+variations, etc.
++
+An absolute bound on the computer's clock accuracy (assuming the stratum-1
+computer is correct) is given by:
++
+----
+clock_error <= root_dispersion + (0.5 * |root_delay|)
+----
+*Update interval*:::
+This is the interval between the last two clock updates.
+*Leap status*:::
+This is the leap status, which can be _Normal_, _Insert second_, _Delete
+second_ or _Not synchronised_.
+
+[[makestep]]*makestep*::
+*makestep* _threshold_ _limit_::
+Normally *chronyd* will cause the system to gradually correct any time offset,
+by slowing down or speeding up the clock as required. In certain situations,
+the system clock might be so far adrift that this slewing process would take a
+very long time to correct the system clock.
++
+The *makestep* command can be used in this situation. There are two forms of
+the command. The first form has no parameters. It tells *chronyd* to cancel any
+remaining correction that was being slewed and jump the system clock by the
+equivalent amount, making it correct immediately.
++
+The second form configures the automatic stepping, similarly to the
+<<chrony.conf.adoc#makestep,*makestep*>> directive. It has two parameters,
+stepping threshold (in seconds) and number of future clock updates for which
+the threshold will be active. This can be used with the <<burst,*burst*>>
+command to quickly make a new measurement and correct the clock by stepping if
+needed, without waiting for *chronyd* to complete the measurement and update
+the clock.
++
+----
+makestep 0.1 1
+burst 1/2
+----
++
+BE WARNED: Certain software will be seriously affected by such jumps in the
+system time. (That is the reason why *chronyd* uses slewing normally.)
+
+[[maxupdateskew]]*maxupdateskew* _skew-in-ppm_::
+This command has the same effect as the
+<<chrony.conf.adoc#maxupdateskew,*maxupdateskew*>> directive in the
+configuration file.
+
+[[waitsync]]*waitsync* [_max-tries_ [_max-correction_ [_max-skew_ [_interval_]]]]::
+The *waitsync* command waits for *chronyd* to synchronise.
++
+Up to four optional arguments can be specified. The first is the maximum number
+of tries before giving up and returning a non-zero error code. When 0 is
+specified, or there are no arguments, the number of tries will not be limited.
++
+The second and third arguments are the maximum allowed remaining correction of
+the system clock and the maximum allowed skew (in ppm) as reported by the
+<<tracking,*tracking*>> command in the *System time* and *Skew* fields. If not
+specified or zero, the value will not be checked.
++
+The fourth argument is the interval specified in seconds in which the check is
+repeated. The interval is 10 seconds by default.
++
+An example is:
++
+----
+waitsync 60 0.01
+----
++
+which will wait up to about 10 minutes (60 times 10 seconds) for *chronyd* to
+synchronise to a source and the remaining correction to be less than 10
+milliseconds.
+
+=== Time sources
+
+[[sources]]*sources* [*-v*]::
+This command displays information about the current time sources that *chronyd*
+is accessing.
++
+The optional argument *-v* can be specified, meaning _verbose_. In this case,
+extra caption lines are shown as a reminder of the meanings of the columns.
++
+----
+210 Number of sources = 3
+MS Name/IP address Stratum Poll Reach LastRx Last sample
+===============================================================================
+#* GPS0 0 4 377 11 -479ns[ -621ns] +/- 134ns
+^? foo.example.net 2 6 377 23 -923us[ -924us] +/- 43ms
+^+ bar.example.net 1 6 377 21 -2629us[-2619us] +/- 86ms
+----
++
+The columns are as follows:
++
+*M*:::
+This indicates the mode of the source. _^_ means a server, _=_ means a peer
+and _#_ indicates a locally connected reference clock.
+*S*:::
+This column indicates the state of the source.
+* _*_ indicates the source to which *chronyd* is currently synchronised.
+* _+_ indicates acceptable sources which are combined with the selected
+ source.
+* _-_ indicates acceptable sources which are excluded by the combining
+ algorithm.
+* _?_ indicates sources to which connectivity has been lost or whose packets
+ do not pass all tests. It is also shown at start-up, until at least 3 samples
+ have been gathered from it.
+* _x_ indicates a clock which *chronyd* thinks is a falseticker (i.e. its
+ time is inconsistent with a majority of other sources).
+* _~_ indicates a source whose time appears to have too much variability.
+*Name/IP address*:::
+This shows the name or the IP address of the source, or reference ID for reference
+clocks.
+*Stratum*:::
+This shows the stratum of the source, as reported in its most recently
+received sample. Stratum 1 indicates a computer with a locally attached
+reference clock. A computer that is synchronised to a stratum 1 computer is
+at stratum 2. A computer that is synchronised to a stratum 2 computer is at
+stratum 3, and so on.
+*Poll*:::
+This shows the rate at which the source is being polled, as a base-2
+logarithm of the interval in seconds. Thus, a value of 6 would indicate that
+a measurement is being made every 64 seconds. *chronyd* automatically varies
+the polling rate in response to prevailing conditions.
+*Reach*:::
+This shows the source's reachability register printed as an octal number. The
+register has 8 bits and is updated on every received or missed packet from
+the source. A value of 377 indicates that a valid reply was received for all
+from the last eight transmissions.
+*LastRx*:::
+This column shows how long ago the last sample was received from the source.
+This is normally in seconds. The letters _m_, _h_, _d_ or _y_ indicate
+minutes, hours, days, or years.
+*Last sample*:::
+This column shows the offset between the local clock and the source at the
+last measurement. The number in the square brackets shows the actual measured
+offset. This can be suffixed by _ns_ (indicating nanoseconds), _us_
+(indicating microseconds), _ms_ (indicating milliseconds), or _s_ (indicating
+seconds). The number to the left of the square brackets shows the original
+measurement, adjusted to allow for any slews applied to the local clock
+since. The number following the _+/-_ indicator shows the margin of error in
+the measurement. Positive offsets indicate that the local clock is ahead of
+the source.
+
+[[sourcestats]]*sourcestats* [*-v*]::
+The *sourcestats* command displays information about the drift rate and offset
+estimation process for each of the sources currently being examined by
+*chronyd*.
++
+The optional argument *-v* can be specified, meaning _verbose_. In this case,
+extra caption lines are shown as a reminder of the meanings of the columns.
++
+An example report is:
++
+----
+210 Number of sources = 1
+Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
+===============================================================================
+foo.example.net 11 5 46m -0.001 0.045 1us 25us
+----
++
+The columns are as follows:
++
+*Name/IP Address*:::
+This is the name or IP address of the NTP server (or peer) or reference ID of the
+reference clock to which the rest of the line relates.
+*NP*:::
+This is the number of sample points currently being retained for the server.
+The drift rate and current offset are estimated by performing a linear
+regression through these points.
+*NR*:::
+This is the number of runs of residuals having the same sign following the
+last regression. If this number starts to become too small relative to the
+number of samples, it indicates that a straight line is no longer a good fit
+to the data. If the number of runs is too low, *chronyd* discards older
+samples and re-runs the regression until the number of runs becomes
+acceptable.
+*Span*:::
+This is the interval between the oldest and newest samples. If no unit is
+shown the value is in seconds. In the example, the interval is 46 minutes.
+*Frequency*:::
+This is the estimated residual frequency for the server, in parts per
+million. In this case, the computer's clock is estimated to be running 1 part
+in 10^9 slow relative to the server.
+*Freq Skew*:::
+This is the estimated error bounds on *Freq* (again in parts per million).
+*Offset*:::
+This is the estimated offset of the source.
+*Std Dev*:::
+This is the estimated sample standard deviation.
+
+[[reselect]]*reselect*::
+To avoid excessive switching between sources, *chronyd* can stay synchronised
+to a source even when it is not currently the best one among the available
+sources.
++
+The *reselect* command can be used to force *chronyd* to reselect the best
+synchronisation source.
+
+[[reselectdist]]*reselectdist* _distance_::
+The *reselectdist* command sets the reselection distance. It is equivalent to
+the <<chrony.conf.adoc#reselectdist,*reselectdist*>> directive in the
+configuration file.
+
+=== NTP sources
+
+[[activity]]*activity*::
+This command reports the number of servers and peers that are online and
+offline. If the *auto_offline* option is used in specifying some of the servers
+or peers, the *activity* command can be useful for detecting when all of them
+have entered the offline state after the network link has been disconnected.
++
+The report shows the number of servers and peers in 5 states:
++
+*online*:::
+the server or peer is currently online (i.e. assumed by *chronyd* to be reachable)
+*offline*:::
+the server or peer is currently offline (i.e. assumed by *chronyd* to be
+unreachable, and no measurements from it will be attempted.)
+*burst_online*:::
+a burst command has been initiated for the server or peer and is being
+performed; after the burst is complete, the server or peer will be returned to
+the online state.
+*burst_offline*:::
+a burst command has been initiated for the server or peer and is being
+performed; after the burst is complete, the server or peer will be returned to
+the offline state.
+*unresolved*:::
+the name of the server or peer was not resolved to an address yet; this source is
+not visible in the *sources* and *sourcestats* reports.
+
+[[add_peer]]*add peer* _address_ [_option_]...::
+The *add peer* command allows a new NTP peer to be added whilst
+*chronyd* is running.
++
+Following the words *add peer*, the syntax of the following
+parameters and options is similar to that for the
+<<chrony.conf.adoc#peer,*peer*>> directive in the configuration file.
+The following peer options can be set in the command: *port*, *minpoll*,
+*maxpoll*, *presend*, *maxdelayratio*, *maxdelay*, *key*.
++
+An example of using this command is shown below.
++
+----
+add peer foo.example.net minpoll 6 maxpoll 10 key 25
+----
+
+[[add_server]]*add server* _address_ [_option_]...::
+The *add server* command allows a new NTP server to be added whilst
+*chronyd* is running.
++
+Following the words *add server*, the syntax of the following parameters and
+options is similar to that for the <<chrony.conf.adoc#server,*server*>>
+directive in the configuration file.
+The following server options can be set in the command: *port*, *minpoll*,
+*maxpoll*, *presend*, *maxdelayratio*, *maxdelay*, *key*.
++
+An example of using this command is shown below:
++
+----
+add server foo.example.net minpoll 6 maxpoll 10 key 25
+----
+
+[[delete]]*delete* _address_::
+The *delete* command allows an NTP server or peer to be removed
+from the current set of sources.
+
+[[burst]]
+*burst* _good_/_max_ [_mask_/_masked-address_]::
+*burst* _good_/_max_ [_masked-address_/_masked-bits_]::
+*burst* _good_/_max_ [_address_]::
+The *burst* command tells *chronyd* to make a set of measurements to each of
+its NTP sources over a short duration (rather than the usual periodic
+measurements that it makes). After such a burst, *chronyd* will revert to the
+previous state for each source. This might be either online, if the source was
+being periodically measured in the normal way, or offline, if the source had
+been indicated as being offline. (A source can be switched between the online
+and offline states with the <<online,*online*>> and <<offline,*offline*>>
+commands.)
++
+The _mask_ and _masked-address_ arguments are optional, in which case *chronyd*
+will initiate a burst for all of its currently defined sources.
++
+The arguments have the following meaning and format:
++
+_good_:::
+This defines the number of good measurements that *chronyd* will want to
+obtain from each source. A measurement is good if it passes certain tests,
+for example, the round trip time to the source must be acceptable. (This
+allows *chronyd* to reject measurements that are likely to be bogus.)
+_max_:::
+This defines the maximum number of measurements that *chronyd* will attempt
+to make, even if the required number of good measurements has not been
+obtained.
+_mask_:::
+This is an IP address with which the IP address of each of *chronyd*'s
+sources is to be masked.
+_masked-address_:::
+This is an IP address. If the masked IP address of a source matches this
+value then the burst command is applied to that source.
+_masked-bits_:::
+This can be used with _masked-address_ for CIDR notation, which is a shorter
+alternative to the form with mask.
+_address_:::
+This is an IP address or a hostname. The burst command is applied only to
+that source.
+::
++
+If no _mask_ or _masked-address_ arguments are provided, every source will be
+matched.
++
+An example of the two-argument form of the command is:
++
+----
+burst 2/10
+----
++
+This will cause *chronyd* to attempt to get two good measurements from each
+source, stopping after two have been obtained, but in no event will it try more
+than ten probes to the source.
++
+Examples of the four-argument form of the command are:
++
+----
+burst 2/10 255.255.0.0/1.2.0.0
+burst 2/10 2001:db8:789a::/48
+----
++
+In the first case, the two out of ten sampling will only be applied to sources
+whose IPv4 addresses are of the form _1.2.x.y_, where _x_ and _y_ are
+arbitrary. In the second case, the sampling will be applied to sources whose
+IPv6 addresses have first 48 bits equal to _2001:db8:789a_.
++
+Example of the three-argument form of the command is:
++
+----
+burst 2/10 foo.example.net
+----
+
+[[maxdelay]]*maxdelay* _address_ _delay_::
+This allows the *maxdelay* option for one of the sources to be modified, in the
+same way as specifying the *maxdelay* option for the
+<<chrony.conf.adoc#server,*server*>> directive in the configuration file.
+
+[[maxdelaydevratio]]*maxdelaydevratio* _address_ _ratio_::
+This allows the *maxdelaydevratio* option for one of the sources to be
+modified, in the same way as specifying the *maxdelaydevratio* option for the
+<<chrony.conf.adoc#server,*server*>> directive in the configuration file.
+
+[[maxdelayratio]]*maxdelayratio* _address_ _ratio_::
+This allows the *maxdelayratio* option for one of the sources to be modified,
+in the same way as specifying the *maxdelayratio* option for the
+<<chrony.conf.adoc#server,*server*>> directive in the configuration file.
+
+[[maxpoll]]*maxpoll* _address_ _maxpoll_::
+The *maxpoll* command is used to modify the maximum polling interval for one of
+the current set of sources. It is equivalent to the *maxpoll* option in the
+<<chrony.conf.adoc#server,*server*>> directive in the configuration file.
++
+Note that the new maximum polling interval only takes effect after the next
+measurement has been made.
+
+[[minpoll]]*minpoll* _address_ _minpoll_::
+The *minpoll* command is used to modify the minimum polling interval for one of
+the current set of sources. It is equivalent to the *minpoll* option in the
+<<chrony.conf.adoc#server,*server*>> directive in the configuration file.
++
+Note that the new minimum polling interval only takes effect after the next
+measurement has been made.
+
+[[minstratum]]*minstratum* _address_ _minstratum_::
+The *minstratum* command is used to modify the minimum stratum for one of the
+current set of sources. It is equivalent to the *minstratum* option in the
+<<chrony.conf.adoc#server,*server*>> directive in the configuration file.
+
+[[offline]]
+*offline* [_address_]::
+*offline* [_masked-address_/_masked-bits_]::
+*offline* [_mask_/_masked-address_]::
+The *offline* command is used to warn *chronyd* that the network connection to
+a particular host or hosts is about to be lost, e.g. on computers with
+intermittent connection to their time sources.
++
+Another case where *offline* could be used is where a computer serves time to a
+local group of computers, and has a permanent connection to true time servers
+outside the organisation. However, the external connection is heavily loaded at
+certain times of the day and the measurements obtained are less reliable at
+those times. In this case, it is probably most useful to determine the
+gain or loss rate during the quiet periods and let the whole network coast through
+the loaded periods. The *offline* and *online* commands can be used to achieve
+this.
++
+There are four forms of the *offline* command. The first form is a wildcard,
+meaning all sources. The second form allows an IP address mask and a masked
+address to be specified. The third form uses CIDR notation. The fourth form
+uses an IP address or a hostname. These forms are illustrated below.
++
+----
+offline
+offline 255.255.255.0/1.2.3.0
+offline 2001:db8:789a::/48
+offline foo.example.net
+----
++
+The second form means that the *offline* command is to be applied to any source
+whose IPv4 address is in the _1.2.3_ subnet. (The host's address is logically
+and-ed with the mask, and if the result matches the _masked-address_ the host
+is processed.) The third form means that the command is to be applied to all
+sources whose IPv6 addresses have their first 48 bits equal to _2001:db8:789a_. The
+fourth form means that the command is to be applied only to that one source.
++
+The wildcard form of the address is equivalent to:
++
+----
+offline 0.0.0.0/0.0.0.0
+offline ::/0
+----
+
+[[online]]
+*online* [_address_]::
+*online* [_masked-address_/_masked-bits_]::
+*online* [_mask_/_masked-address_]::
+The *online* command is opposite in function to the <<offline,*offline*>>
+command. It is used to advise *chronyd* that network connectivity to a
+particular source or sources has been restored.
++
+The syntax is identical to that of the <<offline,*offline*>> command.
+
+[[polltarget]]*polltarget* _address_ _polltarget_::
+The *polltarget* command is used to modify the poll target for one of the
+current set of sources. It is equivalent to the *polltarget* option in the
+<<chrony.conf.adoc#server,*server*>> directive in the configuration file.
+
+[[refresh]]*refresh*::
+The *refresh* command can be used to force *chronyd* to resolve the names of
+configured sources to IP addresses again, e.g. after suspending and resuming
+the machine in a different network.
++
+Sources that stop responding will be replaced with newly resolved addresses
+automatically after 8 polling intervals, but this command can still be useful
+to replace them immediately and not wait until they are marked as unreachable.
+
+=== Manual time input
+
+[[manual]]
+*manual* *on*::
+*manual* *off*::
+*manual* *delete* _index_::
+*manual* *list*::
+*manual* *reset*::
+The manual command enables and disables use of the <<settime,*settime*>>
+command, and is used to modify the behaviour of the manual clock driver.
++
+The *on* form of the command enables use of the *settime* command.
++
+The *off* form of the command disables use of the *settime* command.
++
+The *list* form of the command lists all the samples currently stored in
+*chronyd*. The output is illustrated below.
++
+----
+210 n_samples = 1
+# Date Time(UTC) Slewed Original Residual
+====================================================
+ 0 27Jan99 22:09:20 0.00 0.97 0.00
+----
++
+The columns are as as follows:
++
+. The sample index (used for the *manual delete* command).
+. The date and time of the sample.
+. The system clock error when the timestamp was entered, adjusted to allow
+ for changes made to the system clock since.
+. The system clock error when the timestamp was entered, as it originally was
+ (without allowing for changes to the system clock since).
+. The regression residual at this point, in seconds. This allows '`outliers`'
+ to be easily spotted, so that they can be deleted using the *manual delete*
+ command.
+::
++
+The *delete* form of the command deletes a single sample. The parameter is the
+index of the sample, as shown in the first column of the output from *manual
+list*. Following deletion of the data point, the current error and drift rate
+are re-estimated from the remaining data points and the system clock trimmed if
+necessary. This option is intended to allow '`outliers`' to be discarded, i.e.
+samples where the administrator realises they have entered a very poor
+timestamp.
++
+The *reset* form of the command deletes all samples at once. The system clock
+is left running as it was before the command was entered.
+
+[[settime]]*settime* _time_::
+The *settime* command allows the current time to be entered manually, if this
+option has been configured into *chronyd*. (It can be configured either with
+the <<chrony.conf.adoc#manual,*manual*>> directive in the configuration file,
+or with the <<manual,*manual*>> command of *chronyc*.)
++
+It should be noted that the computer's sense of time will only be as accurate
+as the reference you use for providing this input (e.g. your watch), as well as
+how well you can time the press of the return key.
++
+Providing your computer's time zone is set up properly, you will be able to
+enter a local time (rather than UTC).
++
+The response to a successful *settime* command indicates the amount that the
+computer's clock was wrong. It should be apparent from this if you have entered
+the time wrongly, e.g. with the wrong time zone.
++
+The rate of drift of the system clock is estimated by a regression process
+using the entered measurement and all previous measurements entered during the
+present run of *chronyd*. However, the entered measurement is used for
+adjusting the current clock offset (rather than the estimated intercept from
+the regression, which is ignored). Contrast what happens with the
+<<manual,*manual delete*>> command, where the intercept is used to set the
+current offset (since there is no measurement that has just been entered in
+that case).
++
+The time is parsed by the public domain _getdate_ algorithm. Consequently, you
+can only specify time to the nearest second.
++
+Examples of inputs that are valid are shown below:
++
+----
+settime 16:30
+settime 16:30:05
+settime Nov 21, 2015 16:30:05
+----
++
+For a full description of getdate, see the getdate documentation
+(bundled, for example, with the source for GNU tar).
+
+=== NTP access
+
+[[accheck]]*accheck* _address_::
+This command allows you to check whether client NTP access is allowed from a
+particular host.
++
+Examples of use, showing a named host and a numeric IP address, are as follows:
++
+----
+accheck foo.example.net
+accheck 1.2.3.4
+accheck 2001:db8::1
+----
++
+This command can be used to examine the effect of a series of *allow*, *allow
+all*, *deny*, and *deny all* commands specified either via *chronyc*, or in
+*chronyd*'s configuration file.
+
+[[clients]]*clients*::
+This command shows a list of clients that have accessed the server, through
+either the NTP or command ports. It does not include accesses over
+the Unix domain command socket. There are no arguments.
++
+An example of the output is:
++
+----
+Hostname NTP Drop Int IntL Last Cmd Drop Int Last
+===============================================================================
+localhost 2 0 2 - 133 15 0 -1 7
+foo.example.net 12 0 6 - 23 0 0 - -
+----
++
+Each row shows the data for a single host. Only hosts that have passed the host
+access checks (set with the <<allow,*allow*>>, <<deny,*deny*>>,
+<<cmdallow,*cmdallow*>> and <<cmddeny,*cmddeny*>> commands or configuration
+file directives) are logged. The intervals are displayed as a power of 2 in
+seconds.
++
+The columns are as follows:
++
+. The hostname of the client.
+. The number of NTP packets received from the client.
+. The number of NTP packets dropped to limit the response rate.
+. The average interval between NTP packets.
+. The average interval between NTP packets after limiting the response rate.
+. Time since the last NTP packet was received
+. The number of command packets received from the client.
+. The number of command packets dropped to limit the response rate.
+. The average interval between command packets.
+. Time since the last command packet was received.
+
+[[serverstats]]*serverstats*::
+The *serverstats* command displays how many valid NTP and command requests
+*chronyd* as a server received from clients, how many of them were dropped to
+limit the response rate as configured by the
+<<chrony.conf.adoc#ratelimit,*ratelimit*>> and
+<<chrony.conf.adoc#cmdratelimit,*cmdratelimit*>> directives, and how many
+client log records were dropped due to the memory limit configured by the
+<<chrony.conf.adoc#clientloglimit,*clientloglimit*>> directive. An example of
+the output is shown below.
++
+----
+NTP packets received : 1598
+NTP packets dropped : 8
+Command packets received : 19
+Command packets dropped : 0
+Client log records dropped : 0
+----
+
+[[allow]]*allow* [*all*] [_subnet_]::
+The effect of the allow command is identical to the
+<<chrony.conf.adoc#allow,*allow*>> directive in the configuration file.
++
+The syntax is illustrated in the following examples:
++
+----
+allow foo.example.net
+allow all 1.2
+allow 3.4.5
+allow 6.7.8/22
+allow 6.7.8.9/22
+allow 2001:db8:789a::/48
+allow 0/0
+allow ::/0
+allow
+allow all
+----
+
+[[deny]]*deny* [*all*] [_subnet_]::
+The effect of the allow command is identical to the
+<<chrony.conf.adoc#deny,*deny*>> directive in the configuration file.
++
+The syntax is illustrated in the following examples:
++
+----
+deny foo.example.net
+deny all 1.2
+deny 3.4.5
+deny 6.7.8/22
+deny 6.7.8.9/22
+deny 2001:db8:789a::/48
+deny 0/0
+deny ::/0
+deny
+deny all
+----
+
+[[local]]
+*local* [_option_]...::
+*local* *off*::
+The *local* command allows *chronyd* to be told that it is to appear as a
+reference source, even if it is not itself properly synchronised to an external
+source. (This can be used on isolated networks, to allow one computer to be a
+master time server with the other computers slaving to it.)
++
+The first form enables the local reference mode on the host. The syntax is
+identical to the <<chrony.conf.adoc#local,*local*>> directive in the
+configuration file.
++
+The second form disables the local reference mode.
+
+[[smoothing]]*smoothing*::
+The *smoothing* command displays the current state of the NTP server time
+smoothing, which can be enabled with the
+<<chrony.conf.adoc#smoothtime,*smoothtime*>> directive. An example of the
+output is shown below.
++
+----
+Active : Yes
+Offset : +1.000268817 seconds
+Frequency : -0.142859 ppm
+Wander : -0.010000 ppm per second
+Last update : 17.8 seconds ago
+Remaining time : 19988.4 seconds
+----
++
+The fields are explained as follows:
++
+*Active*:::
+This shows if the server time smoothing is currently active. Possible values
+are _Yes_ and _No_. If the *leaponly* option is included in the *smoothtime*
+directive, _(leap second only)_ will be shown on the line.
+*Offset*:::
+This is the current offset applied to the time sent to NTP clients. Positive
+value means the clients are getting time that's ahead of true time.
+*Frequency*:::
+The current frequency offset of the served time. Negative value means the
+time observed by clients is running slower than true time.
+*Wander*:::
+The current frequency wander of the served time. Negative value means the
+time observed by clients is slowing down.
+*Last update*:::
+This field shows how long ago the time smoothing process was updated, e.g.
+*chronyd* accumulated a new measurement.
+*Remaining time*:::
+The time it would take for the smoothing process to get to zero offset and
+frequency if there were no more updates.
+
+[[smoothtime]]
+*smoothtime* *activate*::
+*smoothtime* *reset*::
+The *smoothtime* command can be used to activate or reset the server time
+smoothing process if it is configured with the
+<<chrony.conf.adoc#smoothtime,*smoothtime*>> directive.
+
+=== Monitoring access
+
+[[cmdaccheck]]*cmdaccheck* _address_::
+This command is similar to the <<accheck,*accheck*>> command, except that it is
+used to check whether monitoring access is permitted from a named host.
++
+Examples of use are as follows:
++
+----
+cmdaccheck foo.example.net
+cmdaccheck 1.2.3.4
+cmdaccheck 2001:db8::1
+----
+
+[[cmdallow]]*cmdallow* [*all*] [_subnet_]::
+This is similar to the <<allow,*allow*>> command, except that it is used to
+allow particular hosts or subnets to use *chronyc* to monitor with *chronyd* on
+the current host.
+
+[[cmddeny]]*cmddeny* [*all*] [_subnet_]::
+This is similar to the <<deny,*deny*>> command, except that it is used to allow
+particular hosts or subnets to use *chronyc* to monitor *chronyd* on the
+current host.
+
+=== Real-time clock (RTC)
+
+[[rtcdata]]*rtcdata*::
+The *rtcdata* command displays the current RTC parameters.
++
+An example output is shown below.
++
+----
+RTC ref time (GMT) : Sat May 30 07:25:56 2015
+Number of samples : 10
+Number of runs : 5
+Sample span period : 549
+RTC is fast by : -1.632736 seconds
+RTC gains time at : -107.623 ppm
+----
++
+The fields have the following meaning:
++
+*RTC ref time (GMT)*:::
+This is the RTC reading the last time its error was measured.
+*Number of samples*:::
+This is the number of previous measurements being used to determine the RTC
+gain or loss rate.
+*Number of runs*:::
+This is the number of runs of residuals of the same sign following the
+regression fit for (RTC error) versus (RTC time). A value which is small
+indicates that the measurements are not well approximated by a linear model,
+and that the algorithm will tend to delete the older measurements to improve
+the fit.
+*Sample span period*:::
+This is the period that the measurements span (from the oldest to the
+newest). Without a unit the value is in seconds; suffixes _m_ for minutes,
+_h_ for hours, _d_ for days or _y_ for years can be used.
+*RTC is fast by*:::
+This is the estimate of how many seconds fast the RTC when it thought
+the time was at the reference time (above). If this value is large, you
+might (or might not) want to use the <<trimrtc,*trimrtc*>> command to bring the
+RTC into line with the system clock. (Note, a large error will not affect
+*chronyd*'s operation, unless it becomes so big as to start causing rounding
+errors.)
+*RTC gains time at*:::
+This is the amount of time gained (positive) or lost (negative) by the real
+time clock for each second that it ticks. It is measured in parts per
+million. So if the value shown was +1, suppose the RTC was exactly right when
+it crosses a particular second boundary. Then it would be 1 microsecond fast
+when it crosses its next second boundary.
+
+[[trimrtc]]*trimrtc*::
+The *trimrtc* command is used to correct the system's real-time clock (RTC) to
+the main system clock. It has no effect if the error between the two clocks is
+currently estimated at less than a second.
++
+The command takes no arguments. It performs the following steps (if the RTC is
+more than 1 second away from the system clock):
++
+. Remember the currently estimated gain or loss rate of the RTC and flush the
+ previous measurements.
+. Step the real-time clock to bring it within a second of the system clock.
+. Make several measurements to accurately determine the new offset between
+ the RTC and the system clock (i.e. the remaining fraction of a second
+ error).
+. Save the RTC parameters to the RTC file (specified with the
+ <<chrony.conf.adoc#rtcfile,*rtcfile*>> directive in the configuration file).
+::
++
+The last step is done as a precaution against the computer suffering a power
+failure before either the daemon exits or the <<writertc,*writertc*>> command
+is issued.
++
+*chronyd* will still work perfectly well both whilst operating and across
+machine reboots even if the *trimrtc* command is never used (and the RTC is
+allowed to drift away from true time). The *trimrtc* command is provided as a
+method by which it can be corrected, in a manner compatible with *chronyd*
+using it to maintain accurate time across machine reboots.
++
+The *trimrtc* command can be executed automatically by *chronyd* with the
+<<chrony.conf.adoc#rtcautotrim,*rtcautotrim*>> directive in the configuration
+file.
+
+[[writertc]]*writertc*::
+The *writertc* command writes the currently estimated error and gain or loss rate
+parameters for the RTC to the RTC file (specified with the
+<<chrony.conf.adoc#rtcfile,*rtcfile*>> directive). This information is also
+written automatically when *chronyd* is killed (by the SIGHUP, SIGINT, SIGQUIT
+or SIGTERM signals) or when the <<trimrtc,*trimrtc*>> command is issued.
+
+=== Other daemon commands
+
+[[cyclelogs]]*cyclelogs*::
+The *cyclelogs* command causes all of *chronyd*'s open log files to be closed
+and re-opened. This allows them to be renamed so that they can be periodically
+purged. An example of how to do this is shown below.
++
+----
+# mv /var/log/chrony/measurements.log /var/log/chrony/measurements1.log
+# chronyc cyclelogs
+# ls -l /var/log/chrony
+-rw-r--r-- 1 root root 0 Jun 8 18:17 measurements.log
+-rw-r--r-- 1 root root 12345 Jun 8 18:17 measurements1.log
+# rm -f measurements1.log
+----
+
+[[dump]]*dump*::
+The *dump* command causes *chronyd* to write its current history of
+measurements for each of its sources to dump files, either for inspection or to
+support the *-r* option when *chronyd* is restarted.
++
+The *dump* command is somewhat equivalent to the
+<<chrony.conf.adoc#dumponexit,*dumponexit*>> directive in the configuration
+file.
++
+To use the *dump* command, you might want to configure the name of the
+directory into which the dump files will be written. This can only be
+done in the configuration file with the <<chrony.conf.adoc#dumpdir,*dumpdir*>>
+directive.
+
+=== Client commands
+
+[[dns]]*dns* _option_::
+The *dns* command configures how hostnames and IP addresses are resolved in
+*chronyc*. IP addresses can be resolved to hostnames when printing results of
+<<sources,*sources*>>, <<sourcestats,*sourcestats*>>, <<tracking,*tracking*>>
+and <<clients,*clients*>> commands. Hostnames are resolved in commands that
+take an address as argument.
++
+There are five options:
++
+*dns -n*:::
+Disables resolving IP addresses to hostnames. Raw IP addresses will be
+displayed.
+*dns +n*:::
+Enables resolving IP addresses to hostnames. This is the default unless
+*chronyc* was started with *-n* option.
+*dns -4*:::
+Resolves hostnames only to IPv4 addresses.
+*dns -6*:::
+Resolves hostnames only to IPv6 addresses.
+*dns -46*:::
+Resolves hostnames to both address families. This is the default behaviour
+unless *chronyc* was started with the *-4* or *-6* option.
+
+[[timeout]]*timeout* _timeout_::
+The *timeout* command sets the initial timeout for *chronyc* requests in
+milliseconds. If no response is received from *chronyd*, the timeout is doubled
+and the request is resent. The maximum number of retries is configured with the
+<<retries,*retries*>> command.
++
+By default, the timeout is 1000 milliseconds.
+
+[[retries]]*retries* _retries_::
+The *retries* command sets the maximum number of retries for *chronyc* requests
+before giving up. The response timeout is controlled by the
+<<timeout,*timeout*>> command.
++
+The default is 2.
+
+[[keygen]]*keygen* [_id_ [_type_ [_bits_]]]::
+The *keygen* command generates a key that can be added to the
+key file (specified with the <<chrony.conf.adoc#keyfile,*keyfile*>> directive)
+to allow NTP authentication between server and client, or peers. The key is
+generated from the _/dev/urandom_ device and it is printed to standard output.
++
+The command has three optional arguments. The first argument is the key number
+(by default 1), which will be specified with the *key* option of the *server*
+or *peer* directives in the configuration file. The second argument is the hash
+function (by default SHA1 or MD5 if SHA1 is not available) and the third
+argument is the number of bits the key should have, between 80 and 4096 bits
+(by default 160 bits).
++
+An example is:
++
+----
+keygen 73 SHA1 256
+----
++
+which generates a 256-bit SHA1 key with number 73. The printed line should
+then be securely transferred and added to the key files on both server and
+client, or peers.
+
+[[exit]]*exit*::
+[[quit]]*quit*::
+The *exit* and *quit* commands exit from *chronyc* and return the user to the shell.
+
+[[help]]*help*::
+The *help* command displays a summary of the commands and their arguments.
+
+== SEE ALSO
+
+<<chrony.conf.adoc#,*chrony.conf(5)*>>, <<chronyd.adoc#,*chronyd(8)*>>
+
+== BUGS
+
+For instructions on how to report bugs, please visit
+https://chrony.tuxfamily.org/.
+
+== AUTHORS
+
+chrony was written by Richard Curnow, Miroslav Lichvar, and others.
diff --git a/doc/chronyc.man.in b/doc/chronyc.man.in
new file mode 100644
index 0000000..272d428
--- /dev/null
+++ b/doc/chronyc.man.in
@@ -0,0 +1,1771 @@
+'\" t
+.\" Title: chronyc
+.\" Author: [see the "AUTHORS" section]
+.\" Generator: Asciidoctor 1.5.4
+.\" Date: 2016-06-07
+.\" Manual: User manual
+.\" Source: chrony @CHRONY_VERSION@
+.\" Language: English
+.\"
+.TH "CHRONYC" "1" "2016-06-07" "chrony @CHRONY_VERSION@" "User manual"
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.ss \n[.ss] 0
+.nh
+.ad l
+.de URL
+\\$2 \(laURL: \\$1 \(ra\\$3
+..
+.if \n[.g] .mso www.tmac
+.LINKSTYLE blue R < >
+.SH "NAME"
+chronyc \- command\-line interface for chrony daemon
+.SH "SYNOPSIS"
+.sp
+\fBchronyc\fP [\fIOPTION\fP]... [\fICOMMAND\fP]...
+.SH "DESCRIPTION"
+.sp
+\fBchronyc\fP is a command\-line interface program which can be used to monitor
+\fBchronyd\fP\(cqs performance and to change various operating parameters whilst it is
+running.
+.sp
+If no commands are specified on the command line, \fBchronyc\fP will expect input
+from the user. The prompt \fIchronyc>\fP will be displayed when it is being run
+from a terminal. If \fBchronyc\fP\(cqs input or output are redirected from or to a file,
+the prompt is not shown.
+.sp
+There are two ways \fBchronyc\fP can access \fBchronyd\fP. One is the Internet
+Protocol (IPv4 or IPv6) and the other is a Unix domain socket, which is
+accessible locally by the root or \fIchrony\fP user. By default, \fBchronyc\fP first
+tries to connect to the Unix domain socket. The compiled\-in default path is
+\fI@CHRONYSOCKDIR@/chronyd.sock\fP. If that fails (e.g. because \fBchronyc\fP is
+running under a non\-root user), it will try to connect to 127.0.0.1 and then
+::1.
+.sp
+Only the following monitoring commands, which do not affect the behaviour of
+\fBchronyd\fP, are allowed from the network: \fBactivity\fP, \fBmanual list\fP,
+\fBrtcdata\fP, \fBsmoothing\fP, \fBsources\fP, \fBsourcestats\fP, \fBtracking\fP, \fBwaitsync\fP. The
+set of hosts from which \fBchronyd\fP will accept these commands can be configured
+with the \fBcmdallow\fP directive in the \fBchronyd\fP\(cqs
+configuration file or the \fBcmdallow\fP command in \fBchronyc\fP. By
+default, the commands are accepted only from localhost (127.0.0.1 or ::1).
+.sp
+All other commands are allowed only through the Unix domain socket. When sent
+over the network, \fBchronyd\fP will respond with a \(oqNot authorised\(cq error, even
+if it is from localhost. In chrony versions before 2.2 they were allowed
+from the network if they were authenticated with a password, but that is no
+longer supported.
+.sp
+Having full access to \fBchronyd\fP via \fBchronyc\fP is more or less equivalent to
+being able to modify the \fBchronyd\fP\(cqs configuration file and restart it.
+.SH "OPTIONS"
+.sp
+\fB\-4\fP
+.RS 4
+With this option hostnames will be resolved only to IPv4 addresses.
+.RE
+.sp
+\fB\-6\fP
+.RS 4
+With this option hostnames will be resolved only to IPv6 addresses.
+.RE
+.sp
+\fB\-n\fP
+.RS 4
+This option disables resolving of IP addresses to hostnames (e.g. to avoid slow
+DNS lookups).
+.RE
+.sp
+\fB\-c\fP
+.RS 4
+This option enables printing of reports in a comma\-separated values (CSV)
+format. IP addresses will not be resolved to hostnames, time will be printed as
+number of seconds since the epoch and values in seconds will not be converted
+to other units.
+.RE
+.sp
+\fB\-d\fP
+.RS 4
+This option enables printing of debugging messages if \fBchronyc\fP was compiled
+with debugging support.
+.RE
+.sp
+\fB\-m\fP
+.RS 4
+Normally, all arguments on the command line are interpreted as one command.
+With this option multiple commands can be specified. Each argument will be
+interpreted as a whole command.
+.RE
+.sp
+\fB\-h\fP \fIhost\fP
+.RS 4
+This option allows the user to specify which host (or comma\-separated list of
+addresses) running the \fBchronyd\fP program is to be contacted. This allows for
+remote monitoring, without having to connect over SSH to the other host first.
+.sp
+The default is to contact \fBchronyd\fP running on the same host where
+\fBchronyc\fP is being run.
+.RE
+.sp
+\fB\-p\fP \fIport\fP
+.RS 4
+This option allows the user to specify the UDP port number which the target
+\fBchronyd\fP is using for its monitoring connections. This defaults to 323; there
+would rarely be a need to change this.
+.RE
+.sp
+\fB\-f\fP \fIfile\fP
+.RS 4
+This option is ignored and is provided only for compatibility.
+.RE
+.sp
+\fB\-a\fP
+.RS 4
+This option is ignored and is provided only for compatibility.
+.RE
+.sp
+\fB\-v\fP
+.RS 4
+With this option \fBchronyc\fP displays its version number on the terminal and
+exits.
+.RE
+.SH "COMMANDS"
+.sp
+This section describes each of the commands available within the \fBchronyc\fP
+program.
+.SS "System clock"
+.sp
+\fBtracking\fP
+.RS 4
+The \fBtracking\fP command displays parameters about the system\(cqs clock
+performance. An example of the output is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Reference ID : 203.0.113.15 (foo.example.net)
+Stratum : 3
+Ref time (UTC) : Fri Feb 3 15:00:29 2012
+System time : 0.000001501 seconds slow of NTP time
+Last offset : \-0.000001632 seconds
+RMS offset : 0.000002360 seconds
+Frequency : 331.898 ppm fast
+Residual freq : 0.004 ppm
+Skew : 0.154 ppm
+Root delay : 0.373169 seconds
+Root dispersion : 0.024780 seconds
+Update interval : 64.2 seconds
+Leap status : Normal
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The fields are explained as follows:
+.sp
+\fBReference ID\fP
+.RS 4
+This is the reference ID and name (or IP address) of the server to which the
+computer is currently synchronised. For IPv4 addresses, the reference ID is
+equal to the address and for IPv6 addresses it is the first 32 bits of the MD5
+sum of the address.
+.sp
+If it is \fI127.127.1.1\fP it means the computer is not synchronised to any
+external source and that you have the \fIlocal\fP mode operating (via the
+\fBlocal\fP command in \fBchronyc\fP, or the
+\fBlocal\fP directive in the configuration file).
+.RE
+.sp
+\fBStratum\fP
+.RS 4
+The stratum indicates how many hops away from a computer with an attached
+reference clock we are. Such a computer is a stratum\-1 computer, so the
+computer in the example is two hops away (i.e. \fIfoo.example.net\fP is a
+stratum\-2 and is synchronised from a stratum\-1).
+.RE
+.sp
+\fBRef time\fP
+.RS 4
+This is the time (UTC) at which the last measurement from the reference
+source was processed.
+.RE
+.sp
+\fBSystem time\fP
+.RS 4
+In normal operation, \fBchronyd\fP by default never steps the system clock, because
+any jump in the time can have adverse consequences for certain application
+programs. Instead, any error in the system clock is corrected by slightly
+speeding up or slowing down the system clock until the error has been removed,
+and then returning to the system clock\(cqs normal speed. A consequence of this is
+that there will be a period when the system clock (as read by other programs)
+will be different from \fBchronyd\fP\(cqs estimate of the current true time (which it
+reports to NTP clients when it is operating in server mode). The value reported
+on this line is the difference due to this effect.
+.RE
+.sp
+\fBLast offset\fP
+.RS 4
+This is the estimated local offset on the last clock update.
+.RE
+.sp
+\fBRMS offset\fP
+.RS 4
+This is a long\-term average of the offset value.
+.RE
+.sp
+\fBFrequency\fP
+.RS 4
+The \(oqfrequency\(cq is the rate by which the system\(cqs clock would be wrong if
+\fBchronyd\fP was not correcting it. It is expressed in ppm (parts per million).
+For example, a value of 1 ppm would mean that when the system\(cqs clock thinks it
+has advanced 1 second, it has actually advanced by 1.000001 seconds relative to
+true time.
+.sp
+As you can see in the example, the clock in the computer is not a very
+good one; it would gain about 30 seconds per day if it was not corrected!
+.RE
+.sp
+\fBResidual freq\fP
+.RS 4
+This shows the \(oqresidual frequency\(cq for the currently selected reference
+source. This reflects any difference between what the measurements from the
+reference source indicate the frequency should be and the frequency currently
+being used.
+.sp
+The reason this is not always zero is that a smoothing procedure is
+applied to the frequency. Each time a measurement from the reference
+source is obtained and a new residual frequency computed, the estimated
+accuracy of this residual is compared with the estimated accuracy (see
+\(oqskew\(cq next) of the existing frequency value. A weighted average is
+computed for the new frequency, with weights depending on these accuracies.
+If the measurements from the reference source follow a consistent trend, the
+residual will be driven to zero over time.
+.RE
+.sp
+\fBSkew\fP
+.RS 4
+This is the estimated error bound on the frequency.
+.RE
+.sp
+\fBRoot delay\fP
+.RS 4
+This is the total of the network path delays to the stratum\-1 computer from
+which the computer is ultimately synchronised.
+.RE
+.sp
+\fBRoot dispersion\fP
+.RS 4
+This is the total dispersion accumulated through all the computers back to
+the stratum\-1 computer from which the computer is ultimately synchronised.
+Dispersion is due to system clock resolution, statistical measurement
+variations, etc.
+.sp
+An absolute bound on the computer\(cqs clock accuracy (assuming the stratum\-1
+computer is correct) is given by:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+clock_error <= root_dispersion + (0.5 * |root_delay|)
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBUpdate interval\fP
+.RS 4
+This is the interval between the last two clock updates.
+.RE
+.sp
+\fBLeap status\fP
+.RS 4
+This is the leap status, which can be \fINormal\fP, \fIInsert second\fP, \fIDelete
+second\fP or \fINot synchronised\fP.
+.RE
+.RE
+.sp
+\fBmakestep\fP, \fBmakestep\fP \fIthreshold\fP \fIlimit\fP
+.RS 4
+Normally \fBchronyd\fP will cause the system to gradually correct any time offset,
+by slowing down or speeding up the clock as required. In certain situations,
+the system clock might be so far adrift that this slewing process would take a
+very long time to correct the system clock.
+.sp
+The \fBmakestep\fP command can be used in this situation. There are two forms of
+the command. The first form has no parameters. It tells \fBchronyd\fP to cancel any
+remaining correction that was being slewed and jump the system clock by the
+equivalent amount, making it correct immediately.
+.sp
+The second form configures the automatic stepping, similarly to the
+\fBmakestep\fP directive. It has two parameters,
+stepping threshold (in seconds) and number of future clock updates for which
+the threshold will be active. This can be used with the \fBburst\fP
+command to quickly make a new measurement and correct the clock by stepping if
+needed, without waiting for \fBchronyd\fP to complete the measurement and update
+the clock.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+makestep 0.1 1
+burst 1/2
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+BE WARNED: Certain software will be seriously affected by such jumps in the
+system time. (That is the reason why \fBchronyd\fP uses slewing normally.)
+.RE
+.sp
+\fBmaxupdateskew\fP \fIskew\-in\-ppm\fP
+.RS 4
+This command has the same effect as the
+\fBmaxupdateskew\fP directive in the
+configuration file.
+.RE
+.sp
+\fBwaitsync\fP [\fImax\-tries\fP [\fImax\-correction\fP [\fImax\-skew\fP [\fIinterval\fP]]]]
+.RS 4
+The \fBwaitsync\fP command waits for \fBchronyd\fP to synchronise.
+.sp
+Up to four optional arguments can be specified. The first is the maximum number
+of tries before giving up and returning a non\-zero error code. When 0 is
+specified, or there are no arguments, the number of tries will not be limited.
+.sp
+The second and third arguments are the maximum allowed remaining correction of
+the system clock and the maximum allowed skew (in ppm) as reported by the
+\fBtracking\fP command in the \fBSystem time\fP and \fBSkew\fP fields. If not
+specified or zero, the value will not be checked.
+.sp
+The fourth argument is the interval specified in seconds in which the check is
+repeated. The interval is 10 seconds by default.
+.sp
+An example is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+waitsync 60 0.01
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+which will wait up to about 10 minutes (60 times 10 seconds) for \fBchronyd\fP to
+synchronise to a source and the remaining correction to be less than 10
+milliseconds.
+.RE
+.SS "Time sources"
+.sp
+\fBsources\fP [\fB\-v\fP]
+.RS 4
+This command displays information about the current time sources that \fBchronyd\fP
+is accessing.
+.sp
+The optional argument \fB\-v\fP can be specified, meaning \fIverbose\fP. In this case,
+extra caption lines are shown as a reminder of the meanings of the columns.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+210 Number of sources = 3
+MS Name/IP address Stratum Poll Reach LastRx Last sample
+===============================================================================
+#* GPS0 0 4 377 11 \-479ns[ \-621ns] +/\- 134ns
+^? foo.example.net 2 6 377 23 \-923us[ \-924us] +/\- 43ms
+^+ bar.example.net 1 6 377 21 \-2629us[\-2619us] +/\- 86ms
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The columns are as follows:
+.sp
+\fBM\fP
+.RS 4
+This indicates the mode of the source. \fI^\fP means a server, \fI=\fP means a peer
+and \fI#\fP indicates a locally connected reference clock.
+.RE
+.sp
+\fBS\fP
+.RS 4
+This column indicates the state of the source.
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fI*\fP indicates the source to which \fBchronyd\fP is currently synchronised.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fI+\fP indicates acceptable sources which are combined with the selected
+source.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fI\-\fP indicates acceptable sources which are excluded by the combining
+algorithm.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fI?\fP indicates sources to which connectivity has been lost or whose packets
+do not pass all tests. It is also shown at start\-up, until at least 3 samples
+have been gathered from it.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fIx\fP indicates a clock which \fBchronyd\fP thinks is a falseticker (i.e. its
+time is inconsistent with a majority of other sources).
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fI~\fP indicates a source whose time appears to have too much variability.
+.RE
+.RE
+.sp
+\fBName/IP address\fP
+.RS 4
+This shows the name or the IP address of the source, or reference ID for reference
+clocks.
+.RE
+.sp
+\fBStratum\fP
+.RS 4
+This shows the stratum of the source, as reported in its most recently
+received sample. Stratum 1 indicates a computer with a locally attached
+reference clock. A computer that is synchronised to a stratum 1 computer is
+at stratum 2. A computer that is synchronised to a stratum 2 computer is at
+stratum 3, and so on.
+.RE
+.sp
+\fBPoll\fP
+.RS 4
+This shows the rate at which the source is being polled, as a base\-2
+logarithm of the interval in seconds. Thus, a value of 6 would indicate that
+a measurement is being made every 64 seconds. \fBchronyd\fP automatically varies
+the polling rate in response to prevailing conditions.
+.RE
+.sp
+\fBReach\fP
+.RS 4
+This shows the source\(cqs reachability register printed as an octal number. The
+register has 8 bits and is updated on every received or missed packet from
+the source. A value of 377 indicates that a valid reply was received for all
+from the last eight transmissions.
+.RE
+.sp
+\fBLastRx\fP
+.RS 4
+This column shows how long ago the last sample was received from the source.
+This is normally in seconds. The letters \fIm\fP, \fIh\fP, \fId\fP or \fIy\fP indicate
+minutes, hours, days, or years.
+.RE
+.sp
+\fBLast sample\fP
+.RS 4
+This column shows the offset between the local clock and the source at the
+last measurement. The number in the square brackets shows the actual measured
+offset. This can be suffixed by \fIns\fP (indicating nanoseconds), \fIus\fP
+(indicating microseconds), \fIms\fP (indicating milliseconds), or \fIs\fP (indicating
+seconds). The number to the left of the square brackets shows the original
+measurement, adjusted to allow for any slews applied to the local clock
+since. The number following the \fI+/\-\fP indicator shows the margin of error in
+the measurement. Positive offsets indicate that the local clock is ahead of
+the source.
+.RE
+.RE
+.sp
+\fBsourcestats\fP [\fB\-v\fP]
+.RS 4
+The \fBsourcestats\fP command displays information about the drift rate and offset
+estimation process for each of the sources currently being examined by
+\fBchronyd\fP.
+.sp
+The optional argument \fB\-v\fP can be specified, meaning \fIverbose\fP. In this case,
+extra caption lines are shown as a reminder of the meanings of the columns.
+.sp
+An example report is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+210 Number of sources = 1
+Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
+===============================================================================
+foo.example.net 11 5 46m \-0.001 0.045 1us 25us
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The columns are as follows:
+.sp
+\fBName/IP Address\fP
+.RS 4
+This is the name or IP address of the NTP server (or peer) or reference ID of the
+reference clock to which the rest of the line relates.
+.RE
+.sp
+\fBNP\fP
+.RS 4
+This is the number of sample points currently being retained for the server.
+The drift rate and current offset are estimated by performing a linear
+regression through these points.
+.RE
+.sp
+\fBNR\fP
+.RS 4
+This is the number of runs of residuals having the same sign following the
+last regression. If this number starts to become too small relative to the
+number of samples, it indicates that a straight line is no longer a good fit
+to the data. If the number of runs is too low, \fBchronyd\fP discards older
+samples and re\-runs the regression until the number of runs becomes
+acceptable.
+.RE
+.sp
+\fBSpan\fP
+.RS 4
+This is the interval between the oldest and newest samples. If no unit is
+shown the value is in seconds. In the example, the interval is 46 minutes.
+.RE
+.sp
+\fBFrequency\fP
+.RS 4
+This is the estimated residual frequency for the server, in parts per
+million. In this case, the computer\(cqs clock is estimated to be running 1 part
+in 10^9 slow relative to the server.
+.RE
+.sp
+\fBFreq Skew\fP
+.RS 4
+This is the estimated error bounds on \fBFreq\fP (again in parts per million).
+.RE
+.sp
+\fBOffset\fP
+.RS 4
+This is the estimated offset of the source.
+.RE
+.sp
+\fBStd Dev\fP
+.RS 4
+This is the estimated sample standard deviation.
+.RE
+.RE
+.sp
+\fBreselect\fP
+.RS 4
+To avoid excessive switching between sources, \fBchronyd\fP can stay synchronised
+to a source even when it is not currently the best one among the available
+sources.
+.sp
+The \fBreselect\fP command can be used to force \fBchronyd\fP to reselect the best
+synchronisation source.
+.RE
+.sp
+\fBreselectdist\fP \fIdistance\fP
+.RS 4
+The \fBreselectdist\fP command sets the reselection distance. It is equivalent to
+the \fBreselectdist\fP directive in the
+configuration file.
+.RE
+.SS "NTP sources"
+.sp
+\fBactivity\fP
+.RS 4
+This command reports the number of servers and peers that are online and
+offline. If the \fBauto_offline\fP option is used in specifying some of the servers
+or peers, the \fBactivity\fP command can be useful for detecting when all of them
+have entered the offline state after the network link has been disconnected.
+.sp
+The report shows the number of servers and peers in 5 states:
+.sp
+\fBonline\fP
+.RS 4
+the server or peer is currently online (i.e. assumed by \fBchronyd\fP to be reachable)
+.RE
+.sp
+\fBoffline\fP
+.RS 4
+the server or peer is currently offline (i.e. assumed by \fBchronyd\fP to be
+unreachable, and no measurements from it will be attempted.)
+.RE
+.sp
+\fBburst_online\fP
+.RS 4
+a burst command has been initiated for the server or peer and is being
+performed; after the burst is complete, the server or peer will be returned to
+the online state.
+.RE
+.sp
+\fBburst_offline\fP
+.RS 4
+a burst command has been initiated for the server or peer and is being
+performed; after the burst is complete, the server or peer will be returned to
+the offline state.
+.RE
+.sp
+\fBunresolved\fP
+.RS 4
+the name of the server or peer was not resolved to an address yet; this source is
+not visible in the \fBsources\fP and \fBsourcestats\fP reports.
+.RE
+.RE
+.sp
+\fBadd peer\fP \fIaddress\fP [\fIoption\fP]...
+.RS 4
+The \fBadd peer\fP command allows a new NTP peer to be added whilst
+\fBchronyd\fP is running.
+.sp
+Following the words \fBadd peer\fP, the syntax of the following
+parameters and options is similar to that for the
+\fBpeer\fP directive in the configuration file.
+The following peer options can be set in the command: \fBport\fP, \fBminpoll\fP,
+\fBmaxpoll\fP, \fBpresend\fP, \fBmaxdelayratio\fP, \fBmaxdelay\fP, \fBkey\fP.
+.sp
+An example of using this command is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+add peer foo.example.net minpoll 6 maxpoll 10 key 25
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBadd server\fP \fIaddress\fP [\fIoption\fP]...
+.RS 4
+The \fBadd server\fP command allows a new NTP server to be added whilst
+\fBchronyd\fP is running.
+.sp
+Following the words \fBadd server\fP, the syntax of the following parameters and
+options is similar to that for the \fBserver\fP
+directive in the configuration file.
+The following server options can be set in the command: \fBport\fP, \fBminpoll\fP,
+\fBmaxpoll\fP, \fBpresend\fP, \fBmaxdelayratio\fP, \fBmaxdelay\fP, \fBkey\fP.
+.sp
+An example of using this command is shown below:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+add server foo.example.net minpoll 6 maxpoll 10 key 25
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBdelete\fP \fIaddress\fP
+.RS 4
+The \fBdelete\fP command allows an NTP server or peer to be removed
+from the current set of sources.
+.RE
+.sp
+\fBburst\fP \fIgood\fP/\fImax\fP [\fImask\fP/\fImasked\-address\fP], \fBburst\fP \fIgood\fP/\fImax\fP [\fImasked\-address\fP/\fImasked\-bits\fP], \fBburst\fP \fIgood\fP/\fImax\fP [\fIaddress\fP]
+.RS 4
+The \fBburst\fP command tells \fBchronyd\fP to make a set of measurements to each of
+its NTP sources over a short duration (rather than the usual periodic
+measurements that it makes). After such a burst, \fBchronyd\fP will revert to the
+previous state for each source. This might be either online, if the source was
+being periodically measured in the normal way, or offline, if the source had
+been indicated as being offline. (A source can be switched between the online
+and offline states with the \fBonline\fP and \fBoffline\fP
+commands.)
+.sp
+The \fImask\fP and \fImasked\-address\fP arguments are optional, in which case \fBchronyd\fP
+will initiate a burst for all of its currently defined sources.
+.sp
+The arguments have the following meaning and format:
+.sp
+\fIgood\fP
+.RS 4
+This defines the number of good measurements that \fBchronyd\fP will want to
+obtain from each source. A measurement is good if it passes certain tests,
+for example, the round trip time to the source must be acceptable. (This
+allows \fBchronyd\fP to reject measurements that are likely to be bogus.)
+.RE
+.sp
+\fImax\fP
+.RS 4
+This defines the maximum number of measurements that \fBchronyd\fP will attempt
+to make, even if the required number of good measurements has not been
+obtained.
+.RE
+.sp
+\fImask\fP
+.RS 4
+This is an IP address with which the IP address of each of \fBchronyd\fP\(cqs
+sources is to be masked.
+.RE
+.sp
+\fImasked\-address\fP
+.RS 4
+This is an IP address. If the masked IP address of a source matches this
+value then the burst command is applied to that source.
+.RE
+.sp
+\fImasked\-bits\fP
+.RS 4
+This can be used with \fImasked\-address\fP for CIDR notation, which is a shorter
+alternative to the form with mask.
+.RE
+.sp
+\fIaddress\fP
+.RS 4
+This is an IP address or a hostname. The burst command is applied only to
+that source.
+.RE
+.RE
+.sp
+
+.RS 4
+.sp
+If no \fImask\fP or \fImasked\-address\fP arguments are provided, every source will be
+matched.
+.sp
+An example of the two\-argument form of the command is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+burst 2/10
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+This will cause \fBchronyd\fP to attempt to get two good measurements from each
+source, stopping after two have been obtained, but in no event will it try more
+than ten probes to the source.
+.sp
+Examples of the four\-argument form of the command are:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+burst 2/10 255.255.0.0/1.2.0.0
+burst 2/10 2001:db8:789a::/48
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+In the first case, the two out of ten sampling will only be applied to sources
+whose IPv4 addresses are of the form \fI1.2.x.y\fP, where \fIx\fP and \fIy\fP are
+arbitrary. In the second case, the sampling will be applied to sources whose
+IPv6 addresses have first 48 bits equal to \fI2001:db8:789a\fP.
+.sp
+Example of the three\-argument form of the command is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+burst 2/10 foo.example.net
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBmaxdelay\fP \fIaddress\fP \fIdelay\fP
+.RS 4
+This allows the \fBmaxdelay\fP option for one of the sources to be modified, in the
+same way as specifying the \fBmaxdelay\fP option for the
+\fBserver\fP directive in the configuration file.
+.RE
+.sp
+\fBmaxdelaydevratio\fP \fIaddress\fP \fIratio\fP
+.RS 4
+This allows the \fBmaxdelaydevratio\fP option for one of the sources to be
+modified, in the same way as specifying the \fBmaxdelaydevratio\fP option for the
+\fBserver\fP directive in the configuration file.
+.RE
+.sp
+\fBmaxdelayratio\fP \fIaddress\fP \fIratio\fP
+.RS 4
+This allows the \fBmaxdelayratio\fP option for one of the sources to be modified,
+in the same way as specifying the \fBmaxdelayratio\fP option for the
+\fBserver\fP directive in the configuration file.
+.RE
+.sp
+\fBmaxpoll\fP \fIaddress\fP \fImaxpoll\fP
+.RS 4
+The \fBmaxpoll\fP command is used to modify the maximum polling interval for one of
+the current set of sources. It is equivalent to the \fBmaxpoll\fP option in the
+\fBserver\fP directive in the configuration file.
+.sp
+Note that the new maximum polling interval only takes effect after the next
+measurement has been made.
+.RE
+.sp
+\fBminpoll\fP \fIaddress\fP \fIminpoll\fP
+.RS 4
+The \fBminpoll\fP command is used to modify the minimum polling interval for one of
+the current set of sources. It is equivalent to the \fBminpoll\fP option in the
+\fBserver\fP directive in the configuration file.
+.sp
+Note that the new minimum polling interval only takes effect after the next
+measurement has been made.
+.RE
+.sp
+\fBminstratum\fP \fIaddress\fP \fIminstratum\fP
+.RS 4
+The \fBminstratum\fP command is used to modify the minimum stratum for one of the
+current set of sources. It is equivalent to the \fBminstratum\fP option in the
+\fBserver\fP directive in the configuration file.
+.RE
+.sp
+\fBoffline\fP [\fIaddress\fP], \fBoffline\fP [\fImasked\-address\fP/\fImasked\-bits\fP], \fBoffline\fP [\fImask\fP/\fImasked\-address\fP]
+.RS 4
+The \fBoffline\fP command is used to warn \fBchronyd\fP that the network connection to
+a particular host or hosts is about to be lost, e.g. on computers with
+intermittent connection to their time sources.
+.sp
+Another case where \fBoffline\fP could be used is where a computer serves time to a
+local group of computers, and has a permanent connection to true time servers
+outside the organisation. However, the external connection is heavily loaded at
+certain times of the day and the measurements obtained are less reliable at
+those times. In this case, it is probably most useful to determine the
+gain or loss rate during the quiet periods and let the whole network coast through
+the loaded periods. The \fBoffline\fP and \fBonline\fP commands can be used to achieve
+this.
+.sp
+There are four forms of the \fBoffline\fP command. The first form is a wildcard,
+meaning all sources. The second form allows an IP address mask and a masked
+address to be specified. The third form uses CIDR notation. The fourth form
+uses an IP address or a hostname. These forms are illustrated below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+offline
+offline 255.255.255.0/1.2.3.0
+offline 2001:db8:789a::/48
+offline foo.example.net
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The second form means that the \fBoffline\fP command is to be applied to any source
+whose IPv4 address is in the \fI1.2.3\fP subnet. (The host\(cqs address is logically
+and\-ed with the mask, and if the result matches the \fImasked\-address\fP the host
+is processed.) The third form means that the command is to be applied to all
+sources whose IPv6 addresses have their first 48 bits equal to \fI2001:db8:789a\fP. The
+fourth form means that the command is to be applied only to that one source.
+.sp
+The wildcard form of the address is equivalent to:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+offline 0.0.0.0/0.0.0.0
+offline ::/0
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBonline\fP [\fIaddress\fP], \fBonline\fP [\fImasked\-address\fP/\fImasked\-bits\fP], \fBonline\fP [\fImask\fP/\fImasked\-address\fP]
+.RS 4
+The \fBonline\fP command is opposite in function to the \fBoffline\fP
+command. It is used to advise \fBchronyd\fP that network connectivity to a
+particular source or sources has been restored.
+.sp
+The syntax is identical to that of the \fBoffline\fP command.
+.RE
+.sp
+\fBpolltarget\fP \fIaddress\fP \fIpolltarget\fP
+.RS 4
+The \fBpolltarget\fP command is used to modify the poll target for one of the
+current set of sources. It is equivalent to the \fBpolltarget\fP option in the
+\fBserver\fP directive in the configuration file.
+.RE
+.sp
+\fBrefresh\fP
+.RS 4
+The \fBrefresh\fP command can be used to force \fBchronyd\fP to resolve the names of
+configured sources to IP addresses again, e.g. after suspending and resuming
+the machine in a different network.
+.sp
+Sources that stop responding will be replaced with newly resolved addresses
+automatically after 8 polling intervals, but this command can still be useful
+to replace them immediately and not wait until they are marked as unreachable.
+.RE
+.SS "Manual time input"
+.sp
+\fBmanual\fP \fBon\fP, \fBmanual\fP \fBoff\fP, \fBmanual\fP \fBdelete\fP \fIindex\fP, \fBmanual\fP \fBlist\fP, \fBmanual\fP \fBreset\fP
+.RS 4
+The manual command enables and disables use of the \fBsettime\fP
+command, and is used to modify the behaviour of the manual clock driver.
+.sp
+The \fBon\fP form of the command enables use of the \fBsettime\fP command.
+.sp
+The \fBoff\fP form of the command disables use of the \fBsettime\fP command.
+.sp
+The \fBlist\fP form of the command lists all the samples currently stored in
+\fBchronyd\fP. The output is illustrated below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+210 n_samples = 1
+# Date Time(UTC) Slewed Original Residual
+====================================================
+ 0 27Jan99 22:09:20 0.00 0.97 0.00
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The columns are as as follows:
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+The sample index (used for the \fBmanual delete\fP command).
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+The date and time of the sample.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+The system clock error when the timestamp was entered, adjusted to allow
+for changes made to the system clock since.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 4.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 4." 4.2
+.\}
+The system clock error when the timestamp was entered, as it originally was
+(without allowing for changes to the system clock since).
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 5.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 5." 4.2
+.\}
+The regression residual at this point, in seconds. This allows \(oqoutliers\(cq
+to be easily spotted, so that they can be deleted using the \fBmanual delete\fP
+command.
+.RE
+.RE
+.sp
+
+.RS 4
+.sp
+The \fBdelete\fP form of the command deletes a single sample. The parameter is the
+index of the sample, as shown in the first column of the output from \fBmanual
+list\fP. Following deletion of the data point, the current error and drift rate
+are re\-estimated from the remaining data points and the system clock trimmed if
+necessary. This option is intended to allow \(oqoutliers\(cq to be discarded, i.e.
+samples where the administrator realises they have entered a very poor
+timestamp.
+.sp
+The \fBreset\fP form of the command deletes all samples at once. The system clock
+is left running as it was before the command was entered.
+.RE
+.sp
+\fBsettime\fP \fItime\fP
+.RS 4
+The \fBsettime\fP command allows the current time to be entered manually, if this
+option has been configured into \fBchronyd\fP. (It can be configured either with
+the \fBmanual\fP directive in the configuration file,
+or with the \fBmanual\fP command of \fBchronyc\fP.)
+.sp
+It should be noted that the computer\(cqs sense of time will only be as accurate
+as the reference you use for providing this input (e.g. your watch), as well as
+how well you can time the press of the return key.
+.sp
+Providing your computer\(cqs time zone is set up properly, you will be able to
+enter a local time (rather than UTC).
+.sp
+The response to a successful \fBsettime\fP command indicates the amount that the
+computer\(cqs clock was wrong. It should be apparent from this if you have entered
+the time wrongly, e.g. with the wrong time zone.
+.sp
+The rate of drift of the system clock is estimated by a regression process
+using the entered measurement and all previous measurements entered during the
+present run of \fBchronyd\fP. However, the entered measurement is used for
+adjusting the current clock offset (rather than the estimated intercept from
+the regression, which is ignored). Contrast what happens with the
+\fBmanual delete\fP command, where the intercept is used to set the
+current offset (since there is no measurement that has just been entered in
+that case).
+.sp
+The time is parsed by the public domain \fIgetdate\fP algorithm. Consequently, you
+can only specify time to the nearest second.
+.sp
+Examples of inputs that are valid are shown below:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+settime 16:30
+settime 16:30:05
+settime Nov 21, 2015 16:30:05
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+For a full description of getdate, see the getdate documentation
+(bundled, for example, with the source for GNU tar).
+.RE
+.SS "NTP access"
+.sp
+\fBaccheck\fP \fIaddress\fP
+.RS 4
+This command allows you to check whether client NTP access is allowed from a
+particular host.
+.sp
+Examples of use, showing a named host and a numeric IP address, are as follows:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+accheck foo.example.net
+accheck 1.2.3.4
+accheck 2001:db8::1
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+This command can be used to examine the effect of a series of \fBallow\fP, \fBallow
+all\fP, \fBdeny\fP, and \fBdeny all\fP commands specified either via \fBchronyc\fP, or in
+\fBchronyd\fP\(cqs configuration file.
+.RE
+.sp
+\fBclients\fP
+.RS 4
+This command shows a list of clients that have accessed the server, through
+either the NTP or command ports. It does not include accesses over
+the Unix domain command socket. There are no arguments.
+.sp
+An example of the output is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Hostname NTP Drop Int IntL Last Cmd Drop Int Last
+===============================================================================
+localhost 2 0 2 \- 133 15 0 \-1 7
+foo.example.net 12 0 6 \- 23 0 0 \- \-
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Each row shows the data for a single host. Only hosts that have passed the host
+access checks (set with the \fBallow\fP, \fBdeny\fP,
+\fBcmdallow\fP and \fBcmddeny\fP commands or configuration
+file directives) are logged. The intervals are displayed as a power of 2 in
+seconds.
+.sp
+The columns are as follows:
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+The hostname of the client.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+The number of NTP packets received from the client.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+The number of NTP packets dropped to limit the response rate.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 4.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 4." 4.2
+.\}
+The average interval between NTP packets.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 5.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 5." 4.2
+.\}
+The average interval between NTP packets after limiting the response rate.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 6.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 6." 4.2
+.\}
+Time since the last NTP packet was received
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 7.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 7." 4.2
+.\}
+The number of command packets received from the client.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 8.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 8." 4.2
+.\}
+The number of command packets dropped to limit the response rate.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 9.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 9." 4.2
+.\}
+The average interval between command packets.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 10.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 10." 4.2
+.\}
+Time since the last command packet was received.
+.RE
+.RE
+.sp
+\fBserverstats\fP
+.RS 4
+The \fBserverstats\fP command displays how many valid NTP and command requests
+\fBchronyd\fP as a server received from clients, how many of them were dropped to
+limit the response rate as configured by the
+\fBratelimit\fP and
+\fBcmdratelimit\fP directives, and how many
+client log records were dropped due to the memory limit configured by the
+\fBclientloglimit\fP directive. An example of
+the output is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+NTP packets received : 1598
+NTP packets dropped : 8
+Command packets received : 19
+Command packets dropped : 0
+Client log records dropped : 0
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBallow\fP [\fBall\fP] [\fIsubnet\fP]
+.RS 4
+The effect of the allow command is identical to the
+\fBallow\fP directive in the configuration file.
+.sp
+The syntax is illustrated in the following examples:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+allow foo.example.net
+allow all 1.2
+allow 3.4.5
+allow 6.7.8/22
+allow 6.7.8.9/22
+allow 2001:db8:789a::/48
+allow 0/0
+allow ::/0
+allow
+allow all
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBdeny\fP [\fBall\fP] [\fIsubnet\fP]
+.RS 4
+The effect of the allow command is identical to the
+\fBdeny\fP directive in the configuration file.
+.sp
+The syntax is illustrated in the following examples:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+deny foo.example.net
+deny all 1.2
+deny 3.4.5
+deny 6.7.8/22
+deny 6.7.8.9/22
+deny 2001:db8:789a::/48
+deny 0/0
+deny ::/0
+deny
+deny all
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBlocal\fP [\fIoption\fP]..., \fBlocal\fP \fBoff\fP
+.RS 4
+The \fBlocal\fP command allows \fBchronyd\fP to be told that it is to appear as a
+reference source, even if it is not itself properly synchronised to an external
+source. (This can be used on isolated networks, to allow one computer to be a
+master time server with the other computers slaving to it.)
+.sp
+The first form enables the local reference mode on the host. The syntax is
+identical to the \fBlocal\fP directive in the
+configuration file.
+.sp
+The second form disables the local reference mode.
+.RE
+.sp
+\fBsmoothing\fP
+.RS 4
+The \fBsmoothing\fP command displays the current state of the NTP server time
+smoothing, which can be enabled with the
+\fBsmoothtime\fP directive. An example of the
+output is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Active : Yes
+Offset : +1.000268817 seconds
+Frequency : \-0.142859 ppm
+Wander : \-0.010000 ppm per second
+Last update : 17.8 seconds ago
+Remaining time : 19988.4 seconds
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The fields are explained as follows:
+.sp
+\fBActive\fP
+.RS 4
+This shows if the server time smoothing is currently active. Possible values
+are \fIYes\fP and \fINo\fP. If the \fBleaponly\fP option is included in the \fBsmoothtime\fP
+directive, \fI(leap second only)\fP will be shown on the line.
+.RE
+.sp
+\fBOffset\fP
+.RS 4
+This is the current offset applied to the time sent to NTP clients. Positive
+value means the clients are getting time that\(cqs ahead of true time.
+.RE
+.sp
+\fBFrequency\fP
+.RS 4
+The current frequency offset of the served time. Negative value means the
+time observed by clients is running slower than true time.
+.RE
+.sp
+\fBWander\fP
+.RS 4
+The current frequency wander of the served time. Negative value means the
+time observed by clients is slowing down.
+.RE
+.sp
+\fBLast update\fP
+.RS 4
+This field shows how long ago the time smoothing process was updated, e.g.
+\fBchronyd\fP accumulated a new measurement.
+.RE
+.sp
+\fBRemaining time\fP
+.RS 4
+The time it would take for the smoothing process to get to zero offset and
+frequency if there were no more updates.
+.RE
+.RE
+.sp
+\fBsmoothtime\fP \fBactivate\fP, \fBsmoothtime\fP \fBreset\fP
+.RS 4
+The \fBsmoothtime\fP command can be used to activate or reset the server time
+smoothing process if it is configured with the
+\fBsmoothtime\fP directive.
+.RE
+.SS "Monitoring access"
+.sp
+\fBcmdaccheck\fP \fIaddress\fP
+.RS 4
+This command is similar to the \fBaccheck\fP command, except that it is
+used to check whether monitoring access is permitted from a named host.
+.sp
+Examples of use are as follows:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+cmdaccheck foo.example.net
+cmdaccheck 1.2.3.4
+cmdaccheck 2001:db8::1
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBcmdallow\fP [\fBall\fP] [\fIsubnet\fP]
+.RS 4
+This is similar to the \fBallow\fP command, except that it is used to
+allow particular hosts or subnets to use \fBchronyc\fP to monitor with \fBchronyd\fP on
+the current host.
+.RE
+.sp
+\fBcmddeny\fP [\fBall\fP] [\fIsubnet\fP]
+.RS 4
+This is similar to the \fBdeny\fP command, except that it is used to allow
+particular hosts or subnets to use \fBchronyc\fP to monitor \fBchronyd\fP on the
+current host.
+.RE
+.SS "Real\-time clock (RTC)"
+.sp
+\fBrtcdata\fP
+.RS 4
+The \fBrtcdata\fP command displays the current RTC parameters.
+.sp
+An example output is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+RTC ref time (GMT) : Sat May 30 07:25:56 2015
+Number of samples : 10
+Number of runs : 5
+Sample span period : 549
+RTC is fast by : \-1.632736 seconds
+RTC gains time at : \-107.623 ppm
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+The fields have the following meaning:
+.sp
+\fBRTC ref time (GMT)\fP
+.RS 4
+This is the RTC reading the last time its error was measured.
+.RE
+.sp
+\fBNumber of samples\fP
+.RS 4
+This is the number of previous measurements being used to determine the RTC
+gain or loss rate.
+.RE
+.sp
+\fBNumber of runs\fP
+.RS 4
+This is the number of runs of residuals of the same sign following the
+regression fit for (RTC error) versus (RTC time). A value which is small
+indicates that the measurements are not well approximated by a linear model,
+and that the algorithm will tend to delete the older measurements to improve
+the fit.
+.RE
+.sp
+\fBSample span period\fP
+.RS 4
+This is the period that the measurements span (from the oldest to the
+newest). Without a unit the value is in seconds; suffixes \fIm\fP for minutes,
+\fIh\fP for hours, \fId\fP for days or \fIy\fP for years can be used.
+.RE
+.sp
+\fBRTC is fast by\fP
+.RS 4
+This is the estimate of how many seconds fast the RTC when it thought
+the time was at the reference time (above). If this value is large, you
+might (or might not) want to use the \fBtrimrtc\fP command to bring the
+RTC into line with the system clock. (Note, a large error will not affect
+\fBchronyd\fP\(cqs operation, unless it becomes so big as to start causing rounding
+errors.)
+.RE
+.sp
+\fBRTC gains time at\fP
+.RS 4
+This is the amount of time gained (positive) or lost (negative) by the real
+time clock for each second that it ticks. It is measured in parts per
+million. So if the value shown was +1, suppose the RTC was exactly right when
+it crosses a particular second boundary. Then it would be 1 microsecond fast
+when it crosses its next second boundary.
+.RE
+.RE
+.sp
+\fBtrimrtc\fP
+.RS 4
+The \fBtrimrtc\fP command is used to correct the system\(cqs real\-time clock (RTC) to
+the main system clock. It has no effect if the error between the two clocks is
+currently estimated at less than a second.
+.sp
+The command takes no arguments. It performs the following steps (if the RTC is
+more than 1 second away from the system clock):
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 1." 4.2
+.\}
+Remember the currently estimated gain or loss rate of the RTC and flush the
+previous measurements.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 2." 4.2
+.\}
+Step the real\-time clock to bring it within a second of the system clock.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 3." 4.2
+.\}
+Make several measurements to accurately determine the new offset between
+the RTC and the system clock (i.e. the remaining fraction of a second
+error).
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 4.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP " 4." 4.2
+.\}
+Save the RTC parameters to the RTC file (specified with the
+\fBrtcfile\fP directive in the configuration file).
+.RE
+.RE
+.sp
+
+.RS 4
+.sp
+The last step is done as a precaution against the computer suffering a power
+failure before either the daemon exits or the \fBwritertc\fP command
+is issued.
+.sp
+\fBchronyd\fP will still work perfectly well both whilst operating and across
+machine reboots even if the \fBtrimrtc\fP command is never used (and the RTC is
+allowed to drift away from true time). The \fBtrimrtc\fP command is provided as a
+method by which it can be corrected, in a manner compatible with \fBchronyd\fP
+using it to maintain accurate time across machine reboots.
+.sp
+The \fBtrimrtc\fP command can be executed automatically by \fBchronyd\fP with the
+\fBrtcautotrim\fP directive in the configuration
+file.
+.RE
+.sp
+\fBwritertc\fP
+.RS 4
+The \fBwritertc\fP command writes the currently estimated error and gain or loss rate
+parameters for the RTC to the RTC file (specified with the
+\fBrtcfile\fP directive). This information is also
+written automatically when \fBchronyd\fP is killed (by the SIGHUP, SIGINT, SIGQUIT
+or SIGTERM signals) or when the \fBtrimrtc\fP command is issued.
+.RE
+.SS "Other daemon commands"
+.sp
+\fBcyclelogs\fP
+.RS 4
+The \fBcyclelogs\fP command causes all of \fBchronyd\fP\(cqs open log files to be closed
+and re\-opened. This allows them to be renamed so that they can be periodically
+purged. An example of how to do this is shown below.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+# mv /var/log/chrony/measurements.log /var/log/chrony/measurements1.log
+# chronyc cyclelogs
+# ls \-l /var/log/chrony
+\-rw\-r\-\-r\-\- 1 root root 0 Jun 8 18:17 measurements.log
+\-rw\-r\-\-r\-\- 1 root root 12345 Jun 8 18:17 measurements1.log
+# rm \-f measurements1.log
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+\fBdump\fP
+.RS 4
+The \fBdump\fP command causes \fBchronyd\fP to write its current history of
+measurements for each of its sources to dump files, either for inspection or to
+support the \fB\-r\fP option when \fBchronyd\fP is restarted.
+.sp
+The \fBdump\fP command is somewhat equivalent to the
+\fBdumponexit\fP directive in the configuration
+file.
+.sp
+To use the \fBdump\fP command, you might want to configure the name of the
+directory into which the dump files will be written. This can only be
+done in the configuration file with the \fBdumpdir\fP
+directive.
+.RE
+.SS "Client commands"
+.sp
+\fBdns\fP \fIoption\fP
+.RS 4
+The \fBdns\fP command configures how hostnames and IP addresses are resolved in
+\fBchronyc\fP. IP addresses can be resolved to hostnames when printing results of
+\fBsources\fP, \fBsourcestats\fP, \fBtracking\fP
+and \fBclients\fP commands. Hostnames are resolved in commands that
+take an address as argument.
+.sp
+There are five options:
+.sp
+\fBdns \-n\fP
+.RS 4
+Disables resolving IP addresses to hostnames. Raw IP addresses will be
+displayed.
+.RE
+.sp
+\fBdns +n\fP
+.RS 4
+Enables resolving IP addresses to hostnames. This is the default unless
+\fBchronyc\fP was started with \fB\-n\fP option.
+.RE
+.sp
+\fBdns \-4\fP
+.RS 4
+Resolves hostnames only to IPv4 addresses.
+.RE
+.sp
+\fBdns \-6\fP
+.RS 4
+Resolves hostnames only to IPv6 addresses.
+.RE
+.sp
+\fBdns \-46\fP
+.RS 4
+Resolves hostnames to both address families. This is the default behaviour
+unless \fBchronyc\fP was started with the \fB\-4\fP or \fB\-6\fP option.
+.RE
+.RE
+.sp
+\fBtimeout\fP \fItimeout\fP
+.RS 4
+The \fBtimeout\fP command sets the initial timeout for \fBchronyc\fP requests in
+milliseconds. If no response is received from \fBchronyd\fP, the timeout is doubled
+and the request is resent. The maximum number of retries is configured with the
+\fBretries\fP command.
+.sp
+By default, the timeout is 1000 milliseconds.
+.RE
+.sp
+\fBretries\fP \fIretries\fP
+.RS 4
+The \fBretries\fP command sets the maximum number of retries for \fBchronyc\fP requests
+before giving up. The response timeout is controlled by the
+\fBtimeout\fP command.
+.sp
+The default is 2.
+.RE
+.sp
+\fBkeygen\fP [\fIid\fP [\fItype\fP [\fIbits\fP]]]
+.RS 4
+The \fBkeygen\fP command generates a key that can be added to the
+key file (specified with the \fBkeyfile\fP directive)
+to allow NTP authentication between server and client, or peers. The key is
+generated from the \fI/dev/urandom\fP device and it is printed to standard output.
+.sp
+The command has three optional arguments. The first argument is the key number
+(by default 1), which will be specified with the \fBkey\fP option of the \fBserver\fP
+or \fBpeer\fP directives in the configuration file. The second argument is the hash
+function (by default SHA1 or MD5 if SHA1 is not available) and the third
+argument is the number of bits the key should have, between 80 and 4096 bits
+(by default 160 bits).
+.sp
+An example is:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+keygen 73 SHA1 256
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+which generates a 256\-bit SHA1 key with number 73. The printed line should
+then be securely transferred and added to the key files on both server and
+client, or peers.
+.RE
+.sp
+\fBexit\fP, \fBquit\fP
+.RS 4
+The \fBexit\fP and \fBquit\fP commands exit from \fBchronyc\fP and return the user to the shell.
+.RE
+.sp
+\fBhelp\fP
+.RS 4
+The \fBhelp\fP command displays a summary of the commands and their arguments.
+.RE
+.SH "SEE ALSO"
+.sp
+\fBchrony.conf(5)\fP, \fBchronyd(8)\fP
+.SH "BUGS"
+.sp
+For instructions on how to report bugs, please visit
+.URL "https://chrony.tuxfamily.org/" "" "."
+.SH "AUTHORS"
+.sp
+chrony was written by Richard Curnow, Miroslav Lichvar, and others. \ No newline at end of file
diff --git a/doc/chronyd.adoc b/doc/chronyd.adoc
new file mode 100644
index 0000000..d54d585
--- /dev/null
+++ b/doc/chronyd.adoc
@@ -0,0 +1,164 @@
+// This file is part of chrony
+//
+// Copyright (C) Richard P. Curnow 1997-2003
+// Copyright (C) Miroslav Lichvar 2009-2016
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of version 2 of the GNU General Public License as
+// published by the Free Software Foundation.
+//
+// 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+= chronyd(8)
+:doctype: manpage
+:man manual: System Administration
+:man source: chrony @CHRONY_VERSION@
+
+== NAME
+
+chronyd - chrony daemon
+
+== SYNOPSIS
+
+*chronyd* [_OPTION_]... [_DIRECTIVE_]...
+
+== DESCRIPTION
+
+*chronyd* is a daemon for synchronisation of the system clock. It can
+synchronise the clock with NTP servers, reference clocks (e.g. a GPS receiver),
+and manual input using wristwatch and keyboard via *chronyc*. It can also
+operate as an NTPv4 (RFC 5905) server and peer to provide a time service to
+other computers in the network.
+
+If no configuration directives are specified on the command line, *chronyd*
+will read them from a configuration file. The compiled-in default location of
+the file is _@SYSCONFDIR@/chrony.conf_.
+
+Information messages and warnings will be logged to syslog.
+
+== OPTIONS
+
+*-4*::
+With this option hostnames will be resolved only to IPv4 addresses and only
+IPv4 sockets will be created.
+
+*-6*::
+With this option hostnames will be resolved only to IPv6 addresses and only
+IPv6 sockets will be created.
+
+*-f* _file_::
+This option can be used to specify an alternate location for the configuration
+file (default _@SYSCONFDIR@/chrony.conf_).
+
+*-n*::
+When run in this mode, the program will not detach itself from the terminal.
+
+*-d*::
+When run in this mode, the program will not detach itself from the terminal,
+and all messages will be sent to the terminal instead of to syslog. When
+*chronyd* was compiled with debugging support, this option can be used twice to
+print also debugging messages.
+
+*-q*::
+When run in this mode, *chronyd* will set the system clock once and exit. It
+will not detach from the terminal.
+
+*-Q*::
+This option is similar to *-q*, but it will only print the offset without any
+corrections of the clock.
+
+*-r*::
+This option will reload sample histories for each of the servers and refclocks
+being used. These histories are created by using the
+<<chronyc.adoc#dump,*dump*>> command in *chronyc*, or by setting the
+<<chrony.conf.adoc#dumponexit,*dumponexit*>> directive in the configuration
+file. This option is useful if you want to stop and restart *chronyd* briefly
+for any reason, e.g. to install a new version. However, it should be used only
+on systems where the kernel can maintain clock compensation whilst not under
+*chronyd*'s control (i.e. Linux, FreeBSD, NetBSD and Solaris).
+
+*-R*::
+When this option is used, the <<chrony.conf.adoc#initstepslew,*initstepslew*>>
+directive and the <<chrony.conf.adoc#makestep,*makestep*>> directive used with
+a positive limit will be ignored. This option is useful when restarting
+*chronyd* and can be used in conjunction with the *-r* option.
+
+*-s*::
+This option will set the system clock from the computer's real-time clock (RTC)
+or to the last modification time of the file specified by the
+<<chrony.conf.adoc#driftfile,*driftfile*>> directive. Real-time clocks are
+supported only on Linux.
++
+If used in conjunction with the *-r* flag, *chronyd* will attempt to preserve
+the old samples after setting the system clock from the RTC. This can be used
+to allow *chronyd* to perform long term averaging of the gain or loss rate
+across system reboots, and is useful for systems with intermittent access to
+network that are shut down when not in use. For this to work well, it relies
+on *chronyd* having been able to determine accurate statistics for the
+difference between the RTC and system clock last time the computer was on.
++
+If the last modification time of the drift file is later than both the current
+time and the RTC time, the system time will be set to it to restore the time
+when *chronyd* was previously stopped. This is useful on computers that have no
+RTC or the RTC is broken (e.g. it has no battery).
+
+*-u* _user_::
+This option sets the name of the system user to which *chronyd* will switch
+after start in order to drop root privileges. It overrides the
+<<chrony.conf.adoc#user,*user*>> directive (default _@DEFAULT_USER@_).
++
+On Linux, *chronyd* needs to be compiled with support for the *libcap* library.
+On Mac OS X, FreeBSD, NetBSD and Solaris *chronyd* forks into two processes.
+The child process retains root privileges, but can only perform a very limited
+range of privileged system calls on behalf of the parent.
+
+*-F* _level_::
+This option configures a system call filter when *chronyd* is compiled with
+support for the Linux secure computing (seccomp) facility. In level 1 the
+process is killed when a forbidden system call is made, in level -1 the SYSSIG
+signal is thrown instead and in level 0 the filter is disabled (default 0).
++
+It's recommended to enable the filter only when it's known to work on the
+version of the system where *chrony* is installed as the filter needs to allow
+also system calls made from libraries that *chronyd* is using (e.g. libc) and
+different versions or implementations of the libraries may make different
+system calls. If the filter is missing some system call, *chronyd* could be
+killed even in normal operation.
+
+*-P* _priority_::
+On Linux, this option will select the SCHED_FIFO real-time scheduler at the
+specified priority (which must be between 0 and 100). On Mac OS X, this option
+must have either a value of 0 (the default) to disable the thread time
+constraint policy or 1 for the policy to be enabled. Other systems do not
+support this option.
+
+*-m*::
+This option will lock *chronyd* into RAM so that it will never be paged out.
+This mode is only supported on Linux.
+
+*-v*::
+With this option *chronyd* will print version number to the terminal and exit.
+
+== FILES
+
+_@SYSCONFDIR@/chrony.conf_
+
+== SEE ALSO
+
+<<chronyc.adoc#,*chronyc(1)*>>, <<chrony.conf.adoc#,*chrony.conf(5)*>>
+
+== BUGS
+
+For instructions on how to report bugs, please visit
+https://chrony.tuxfamily.org/.
+
+== AUTHORS
+
+chrony was written by Richard Curnow, Miroslav Lichvar and others.
diff --git a/doc/chronyd.man.in b/doc/chronyd.man.in
new file mode 100644
index 0000000..3157834
--- /dev/null
+++ b/doc/chronyd.man.in
@@ -0,0 +1,183 @@
+'\" t
+.\" Title: chronyd
+.\" Author: [see the "AUTHORS" section]
+.\" Generator: Asciidoctor 1.5.4
+.\" Date: 2016-06-07
+.\" Manual: System Administration
+.\" Source: chrony @CHRONY_VERSION@
+.\" Language: English
+.\"
+.TH "CHRONYD" "8" "2016-06-07" "chrony @CHRONY_VERSION@" "System Administration"
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.ss \n[.ss] 0
+.nh
+.ad l
+.de URL
+\\$2 \(laURL: \\$1 \(ra\\$3
+..
+.if \n[.g] .mso www.tmac
+.LINKSTYLE blue R < >
+.SH "NAME"
+chronyd \- chrony daemon
+.SH "SYNOPSIS"
+.sp
+\fBchronyd\fP [\fIOPTION\fP]... [\fIDIRECTIVE\fP]...
+.SH "DESCRIPTION"
+.sp
+\fBchronyd\fP is a daemon for synchronisation of the system clock. It can
+synchronise the clock with NTP servers, reference clocks (e.g. a GPS receiver),
+and manual input using wristwatch and keyboard via \fBchronyc\fP. It can also
+operate as an NTPv4 (RFC 5905) server and peer to provide a time service to
+other computers in the network.
+.sp
+If no configuration directives are specified on the command line, \fBchronyd\fP
+will read them from a configuration file. The compiled\-in default location of
+the file is \fI@SYSCONFDIR@/chrony.conf\fP.
+.sp
+Information messages and warnings will be logged to syslog.
+.SH "OPTIONS"
+.sp
+\fB\-4\fP
+.RS 4
+With this option hostnames will be resolved only to IPv4 addresses and only
+IPv4 sockets will be created.
+.RE
+.sp
+\fB\-6\fP
+.RS 4
+With this option hostnames will be resolved only to IPv6 addresses and only
+IPv6 sockets will be created.
+.RE
+.sp
+\fB\-f\fP \fIfile\fP
+.RS 4
+This option can be used to specify an alternate location for the configuration
+file (default \fI@SYSCONFDIR@/chrony.conf\fP).
+.RE
+.sp
+\fB\-n\fP
+.RS 4
+When run in this mode, the program will not detach itself from the terminal.
+.RE
+.sp
+\fB\-d\fP
+.RS 4
+When run in this mode, the program will not detach itself from the terminal,
+and all messages will be sent to the terminal instead of to syslog. When
+\fBchronyd\fP was compiled with debugging support, this option can be used twice to
+print also debugging messages.
+.RE
+.sp
+\fB\-q\fP
+.RS 4
+When run in this mode, \fBchronyd\fP will set the system clock once and exit. It
+will not detach from the terminal.
+.RE
+.sp
+\fB\-Q\fP
+.RS 4
+This option is similar to \fB\-q\fP, but it will only print the offset without any
+corrections of the clock.
+.RE
+.sp
+\fB\-r\fP
+.RS 4
+This option will reload sample histories for each of the servers and refclocks
+being used. These histories are created by using the
+\fBdump\fP command in \fBchronyc\fP, or by setting the
+\fBdumponexit\fP directive in the configuration
+file. This option is useful if you want to stop and restart \fBchronyd\fP briefly
+for any reason, e.g. to install a new version. However, it should be used only
+on systems where the kernel can maintain clock compensation whilst not under
+\fBchronyd\fP\(cqs control (i.e. Linux, FreeBSD, NetBSD and Solaris).
+.RE
+.sp
+\fB\-R\fP
+.RS 4
+When this option is used, the \fBinitstepslew\fP
+directive and the \fBmakestep\fP directive used with
+a positive limit will be ignored. This option is useful when restarting
+\fBchronyd\fP and can be used in conjunction with the \fB\-r\fP option.
+.RE
+.sp
+\fB\-s\fP
+.RS 4
+This option will set the system clock from the computer\(cqs real\-time clock (RTC)
+or to the last modification time of the file specified by the
+\fBdriftfile\fP directive. Real\-time clocks are
+supported only on Linux.
+.sp
+If used in conjunction with the \fB\-r\fP flag, \fBchronyd\fP will attempt to preserve
+the old samples after setting the system clock from the RTC. This can be used
+to allow \fBchronyd\fP to perform long term averaging of the gain or loss rate
+across system reboots, and is useful for systems with intermittent access to
+network that are shut down when not in use. For this to work well, it relies
+on \fBchronyd\fP having been able to determine accurate statistics for the
+difference between the RTC and system clock last time the computer was on.
+.sp
+If the last modification time of the drift file is later than both the current
+time and the RTC time, the system time will be set to it to restore the time
+when \fBchronyd\fP was previously stopped. This is useful on computers that have no
+RTC or the RTC is broken (e.g. it has no battery).
+.RE
+.sp
+\fB\-u\fP \fIuser\fP
+.RS 4
+This option sets the name of the system user to which \fBchronyd\fP will switch
+after start in order to drop root privileges. It overrides the
+\fBuser\fP directive (default \fI@DEFAULT_USER@\fP).
+.sp
+On Linux, \fBchronyd\fP needs to be compiled with support for the \fBlibcap\fP library.
+On Mac OS X, FreeBSD, NetBSD and Solaris \fBchronyd\fP forks into two processes.
+The child process retains root privileges, but can only perform a very limited
+range of privileged system calls on behalf of the parent.
+.RE
+.sp
+\fB\-F\fP \fIlevel\fP
+.RS 4
+This option configures a system call filter when \fBchronyd\fP is compiled with
+support for the Linux secure computing (seccomp) facility. In level 1 the
+process is killed when a forbidden system call is made, in level \-1 the SYSSIG
+signal is thrown instead and in level 0 the filter is disabled (default 0).
+.sp
+It\(cqs recommended to enable the filter only when it\(cqs known to work on the
+version of the system where \fBchrony\fP is installed as the filter needs to allow
+also system calls made from libraries that \fBchronyd\fP is using (e.g. libc) and
+different versions or implementations of the libraries may make different
+system calls. If the filter is missing some system call, \fBchronyd\fP could be
+killed even in normal operation.
+.RE
+.sp
+\fB\-P\fP \fIpriority\fP
+.RS 4
+On Linux, this option will select the SCHED_FIFO real\-time scheduler at the
+specified priority (which must be between 0 and 100). On Mac OS X, this option
+must have either a value of 0 (the default) to disable the thread time
+constraint policy or 1 for the policy to be enabled. Other systems do not
+support this option.
+.RE
+.sp
+\fB\-m\fP
+.RS 4
+This option will lock \fBchronyd\fP into RAM so that it will never be paged out.
+This mode is only supported on Linux.
+.RE
+.sp
+\fB\-v\fP
+.RS 4
+With this option \fBchronyd\fP will print version number to the terminal and exit.
+.RE
+.SH "FILES"
+.sp
+\fI@SYSCONFDIR@/chrony.conf\fP
+.SH "SEE ALSO"
+.sp
+\fBchronyc(1)\fP, \fBchrony.conf(5)\fP
+.SH "BUGS"
+.sp
+For instructions on how to report bugs, please visit
+.URL "https://chrony.tuxfamily.org/" "" "."
+.SH "AUTHORS"
+.sp
+chrony was written by Richard Curnow, Miroslav Lichvar and others. \ No newline at end of file
diff --git a/doc/faq.adoc b/doc/faq.adoc
new file mode 100644
index 0000000..01076ef
--- /dev/null
+++ b/doc/faq.adoc
@@ -0,0 +1,404 @@
+// This file is part of chrony
+//
+// Copyright (C) Richard P. Curnow 1997-2003
+// Copyright (C) Miroslav Lichvar 2014-2016
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of version 2 of the GNU General Public License as
+// published by the Free Software Foundation.
+//
+// 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+= Frequently Asked Questions
+:toc:
+:numbered:
+
+== `chrony` compared to other programs
+
+=== How does `chrony` compare to `ntpd`?
+
+`chronyd` was designed to work well in a wide range of conditions and it can
+usually synchronise the system clock faster and with better time accuracy. It
+doesn't implement some of the less useful NTP modes like broadcast client or
+multicast server/client.
+
+If your computer is connected to the Internet only for few minutes at a time,
+the network connection is often congested, you turn your computer off or
+suspend it frequently, the clock is not very stable (e.g. there are rapid
+changes in the temperature or it's a virtual machine), or you want to use NTP
+on an isolated network with no hardware reference clocks in sight, `chrony`
+will probably work much better for you.
+
+For a more detailed comparison of features and performance, see the
+https://chrony.tuxfamily.org/comparison.html[comparison page] on the `chrony`
+website.
+
+== Configuration issues
+
+=== What is the minimum recommended configuration for an NTP client?
+
+First, the client needs to know which NTP servers it should ask for the current
+time. They are specified by the `server` or `pool` directive. The `pool`
+directive can be used for names that resolve to multiple addresses. For good
+reliability the client should have at least three servers. The `iburst` option
+speeds up the initial synchronisation.
+
+To stabilize the initial synchronisation on the next start, the estimated drift
+of the system clock is saved to a file specified by the `driftfile` directive.
+
+If the system clock can be far from the true time after boot for any reason,
+`chronyd` should be allowed to correct it quickly by stepping instead of
+slewing, which would take a very long time. The `makestep` directive does
+that.
+
+In order to keep the real-time clock (RTC) close to the true time, so the
+system time is reasonably close to the true time when it's initialized on the
+next boot from the RTC, the `rtcsync` directive enables a mode in which the
+system time is periodically copied to the RTC. It is supported on Linux and Mac
+OS X.
+
+If you want to use public NTP servers from the
+http://www.pool.ntp.org/[pool.ntp.org] project, the minimal _chrony.conf_ file
+could be:
+
+----
+pool pool.ntp.org iburst
+driftfile /var/lib/chrony/drift
+makestep 1 3
+rtcsync
+----
+
+=== How do I make an NTP server from an NTP client?
+
+You need to add an `allow` directive to the _chrony.conf_ file in order to open
+the NTP port and allow `chronyd` to reply to client requests. `allow` with no
+specified subnet allows all IPv4 and IPv6 addresses.
+
+=== I have several computers on a LAN. Should be all clients of an external server?
+
+The best configuration is usually to make one computer the server, with
+the others as clients of it. Add a `local` directive to the server's
+_chrony.conf_ file. This configuration will be better because
+
+* the load on the external connection is less
+* the load on the external NTP server(s) is less
+* if your external connection goes down, the computers on the LAN
+ will maintain a common time with each other.
+
+=== Must I specify servers by IP address if DNS is not available on chronyd start?
+
+No. Starting from version 1.25, `chronyd` will keep trying to resolve
+the names specified by the `server`, `pool`, and `peer` directives in an
+increasing interval until it succeeds. The `online` command can be issued from
+`chronyc` to try to resolve them immediately.
+
+=== How can I make `chronyd` more secure?
+
+If you don't need to serve time to NTP clients or peers, you can add `port 0`
+to the _chrony.conf_ file to completely disable the NTP server functionality
+and prevent NTP requests from reaching `chronyd`. Starting from version 2.0,
+the NTP server port is open only when client access is allowed by the `allow`
+directive or command, an NTP peer is configured, or the `broadcast` directive
+is used.
+
+If you don't need to use `chronyc` remotely, you can add the following
+directives to the configuration file to bind the command sockets to the
+loopback interface. This is done by default since version 2.0.
+
+----
+bindcmdaddress 127.0.0.1
+bindcmdaddress ::1
+----
+
+If you don't need to use `chronyc` at all or you need to run `chronyc` only
+under the root or _chrony_ user (which can access `chronyd` through a Unix
+domain socket since version 2.2), you can disable the internet command sockets
+completely by adding `cmdport 0` to the configuration file.
+
+You can specify an unprivileged user with the `-u` option, or the `user`
+directive in the _chrony.conf_ file, to which `chronyd` will switch after start
+in order to drop root privileges. The configure script has a `--with-user`
+option, which sets the default user. On Linux, `chronyd` needs to be compiled
+with support for the `libcap` library. On other systems, `chronyd` forks into
+two processes. The child process retains root privileges, but can only perform
+a very limited range of privileged system calls on behalf of the parent.
+
+Also, if `chronyd` is compiled with support for the Linux secure computing
+(seccomp) facility, you can enable a system call filter with the `-F` option.
+It will significantly reduce the kernel attack surface and possibly prevent
+kernel exploits from the `chronyd` process if it's compromised. It's
+recommended to enable the filter only when it's known to work on the version of
+the system where `chrony` is installed as the filter needs to allow also system
+calls made from libraries that `chronyd` is using (e.g. libc) and different
+versions or implementations of the libraries may make different system calls.
+If the filter is missing some system call, `chronyd` could be killed even in
+normal operation.
+
+=== How can I improve the accuracy of the system clock with NTP sources?
+
+Select NTP servers that are well synchronised, stable and close to your
+network. It's better to use more than one server, three or four is usually
+recommended as the minimum, so `chronyd` can detect servers that serve false
+time and combine measurements from multiple sources.
+
+There are also useful options which can be set in the `server` directive, they
+are `minpoll`, `maxpoll`, `polltarget`, `maxdelay`, `maxdelayratio` and
+`maxdelaydevratio`.
+
+The first three options set the minimum and maximum allowed polling interval,
+and how should be the actual interval adjusted in the specified range. Their
+default values are 6 (64 seconds) for `minpoll`, 10 (1024 seconds) for
+`maxpoll` and 6 (samples) for `polltarget`. The default values should be used
+for general servers on the Internet. With your own NTP servers or if have
+permission to poll some servers more frequently, setting these options for
+shorter polling intervals may significantly improve the accuracy of the system
+clock.
+
+The optimal polling interval depends mainly on two factors, stability of the
+network latency and stability of the system clock (which mainly depends on the
+temperature sensitivity of the crystal oscillator and the maximum rate of the
+temperature change).
+
+An example of the directive for an NTP server on the Internet that you are
+allowed to poll frequently could be
+
+----
+server foo.example.net minpoll 4 maxpoll 6 polltarget 16
+----
+
+An example using very short polling intervals for a server located in the same
+LAN could be
+
+----
+server ntp.local minpoll 2 maxpoll 4 polltarget 30
+----
+
+The maxdelay options are useful to ignore measurements with larger delay (e.g.
+due to congestion in the network) and improve the stability of the
+synchronisation. The `maxdelaydevratio` option could be added to the example
+with local NTP server
+
+----
+server ntp.local minpoll 2 maxpoll 4 polltarget 30 maxdelaydevratio 2
+----
+
+=== What happened to the `commandkey` and `generatecommandkey` directives?
+
+They were removed in version 2.2. Authentication is no longer supported in the
+command protocol. Commands that required authentication are now allowed only
+through a Unix domain socket, which is accessible only by the root and _chrony_
+users. If you need to configure `chronyd` remotely or locally without the root
+password, please consider using ssh and/or sudo to run `chronyc` under the root
+or _chrony_ user on the host where `chronyd` is running.
+
+== Computer is not synchronising
+
+This is the most common problem. There are a number of reasons, see the
+following questions.
+
+=== Behind a firewall?
+
+Check the `Reach` value printed by the ``chronyc``'s `sources` command. If it's
+zero, it means `chronyd` did not get any valid responses from the NTP server
+you are trying to use. If there is a firewall between you and the server, the
+packets may be blocked. Try using a tool like `wireshark` or `tcpdump` to see
+if you're getting any responses from the server.
+
+When `chronyd` is receiving responses from the servers, the output of the
+`sources` command issued few minutes after `chronyd` start might look like
+this:
+
+----
+210 Number of sources = 3
+MS Name/IP address Stratum Poll Reach LastRx Last sample
+===============================================================================
+^* foo.example.net 2 6 377 34 +484us[ -157us] +/- 30ms
+^- bar.example.net 2 6 377 34 +33ms[ +32ms] +/- 47ms
+^+ baz.example.net 3 6 377 35 -1397us[-2033us] +/- 60ms
+----
+
+=== Are NTP servers specified with the `offline` option?
+
+Check that you're using ``chronyc``'s `online` and `offline` commands
+appropriately. Again, check in _measurements.log_ to see if you're getting any
+data back from the server.
+
+=== Is `chronyd` allowed to step the system clock?
+
+By default, `chronyd` adjusts the clock gradually by slowing it down or
+speeding it up. If the clock is too far from the true time, it will take
+a long time to correct the error. The `System time` value printed by the
+``chronyc``'s `tracking` command is the remaining correction that needs to be
+applied to the system clock.
+
+The `makestep` directive can be used to allow `chronyd` to step the clock. For
+example, if _chrony.conf_ had
+
+----
+makestep 1 3
+----
+
+the clock would be stepped in the first three updates if its offset was larger
+than one second. Normally, it's recommended to allow the step only in the first
+few updates, but in some cases (e.g. a computer without an RTC or virtual
+machine which can be suspended and resumed with an incorrect time) it may be
+necessary to allow the step on any clock update. The example above would change
+to
+
+----
+makestep 1 -1
+----
+
+== Issues with `chronyc`
+
+=== I keep getting the error `506 Cannot talk to daemon`
+
+When accessing `chronyd` remotely, make sure that the _chrony.conf_ file (on
+the computer where `chronyd` is running) has a `cmdallow` entry for the
+computer you are running `chronyc` on and an appropriate `bindcmdaddress`
+directive. This isn't necessary for localhost.
+
+Perhaps `chronyd` is not running. Try using the `ps` command (e.g. on Linux,
+`ps -auxw`) to see if it's running. Or try `netstat -a` and see if the ports
+123/udp and 323/udp are listening. If `chronyd` is not running, you may have a
+problem with the way you are trying to start it (e.g. at boot time).
+
+Perhaps you have a firewall set up in a way that blocks packets on port
+323/udp. You need to amend the firewall configuration in this case.
+
+=== I keep getting the error `501 Not authorised`
+
+Since version 2.2, the `password` command doesn't do anything and `chronyc`
+needs to run locally under the root or _chrony_ user, which are allowed to
+access the ``chronyd``'s Unix domain command socket.
+
+With older versions, you need to authenticate with the `password` command first
+or use the `-a` option to authenticate automatically on start. The
+configuration file needs to specify a file which contains keys (`keyfile`
+directive) and which key in the key file should be used for `chronyc`
+authentication (`commandkey` directive).
+
+=== Why does `chronyc tracking` always print an IPv4 address as reference ID?
+
+The reference ID is a 32-bit value and is always printed in quad-dotted
+notation, even if the reference source doesn't have an IPv4 address. For IPv4
+addresses, the reference ID is equal to the address, but for IPv6 addresses it
+is the first 32 bits of the MD5 sum of the address. For reference clocks, the
+reference ID is the value specified with the `refid` option in the `refclock`
+directive.
+
+If you need to get the IP address of the current reference source, use the `-n`
+option to disable resolving of IP addresses and read the second field (printed
+in parentheses) on the `Reference ID` line.
+
+=== Is the `chronyc` / `chronyd` protocol documented anywhere?
+
+Only by the source code. See _cmdmon.c_ (`chronyd` side) and _client.c_
+(`chronyc` side).
+
+== Real-time clock issues
+
+=== What is the real-time clock (RTC)?
+
+This is the clock which keeps the time even when your computer is turned off.
+It is used to initialize the system clock on boot. It normally doesn't drift
+more than few seconds per day.
+
+There are two approaches how `chronyd` can work with it. One is to use the
+`rtcsync` directive, which tells `chronyd` to enable a kernel mode which sets
+the RTC from the system clock every 11 minutes. `chronyd` itself won't touch
+the RTC. If the computer is not turned off for a long time, the RTC should
+still be close to the true time when the system clock will be initialized from
+it on the next boot.
+
+The other option is to use the `rtcfile` directive, which tells `chronyd` to
+monitor the rate at which the RTC gains or loses time. When `chronyd` is
+started with the `-s` option on the next boot, it will set the system time from
+the RTC and also compensate for the drift it has measured previously. The
+`rtcautotrim` directive can be used to keep the RTC close to the true time, but
+it's not strictly necessary if its only purpose is to set the system clock when
+`chronyd` is started on boot. See the documentation for details.
+
+=== I want to use ``chronyd``'s RTC support. Must I disable `hwclock`?
+
+The `hwclock` program is often set-up by default in the boot and shutdown
+scripts with many Linux installations. With the kernel RTC synchronisation
+(`rtcsync` directive), the RTC will be set also every 11 minutes as long as the
+system clock is synchronised. If you want to use ``chronyd``'s RTC monitoring
+(`rtcfile` directive), it's important to disable `hwclock` in the shutdown
+procedure. If you don't, it will over-write the RTC with a new value, unknown
+to `chronyd`. At the next reboot, `chronyd` started with the `-s` option will
+compensate this (wrong) time with its estimate of how far the RTC has drifted
+whilst the power was off, giving a meaningless initial system time.
+
+There is no need to remove `hwclock` from the boot process, as long as `chronyd`
+is started after it has run.
+
+=== I just keep getting the `513 RTC driver not running` message
+
+For the real-time clock support to work, you need the following three
+things
+
+* an RTC in your computer
+* a Linux kernel with enabled RTC support
+* an `rtcfile` directive in your _chrony.conf_ file
+
+=== I get `Could not open /dev/rtc, Device or resource busy` in my syslog file
+
+Some other program running on the system may be using the device.
+
+== NTP-specific issues
+
+=== Can `chronyd` be driven from broadcast NTP servers?
+
+No, the broadcast client mode is not supported and there is currently no plan
+to implement it. The broadcast and multicast modes are inherently less
+accurate and less secure (even with authentication) than the ordinary
+server/client mode and they are not as useful as they used to be. Even with
+very modest hardware a single NTP server can serve time to hundreds of
+thousands of clients using the ordinary mode.
+
+=== Can `chronyd` transmit broadcast NTP packets?
+
+Yes, the `broadcast` directive can be used to enable the broadcast server mode
+to serve time to clients in the network which support the broadcast client mode
+(it's not supported in `chronyd`, see the previous question).
+
+=== Can `chronyd` keep the system clock a fixed offset away from real time?
+
+This is not possible as the program currently stands.
+
+=== What happens if the network connection is dropped without using ``chronyc``'s `offline` command first?
+
+`chronyd` will keep trying to access the server(s) that it thinks are online.
+When the network is connected again, it will take some time (on average half of
+the maximum polling interval) before new measurements are made and the clock is
+corrected. If the servers were set to offline and the `online` command was
+issued when the network was connected, `chronyd` would make new measurements
+immediately.
+
+The `auto_offline` option to the `server` entry in the _chrony.conf_ file may
+be useful to switch the servers to the offline state automatically.
+
+== Operating systems
+
+=== Does `chrony` support Windows?
+
+No. The `chronyc` program (the command-line client used for configuring
+`chronyd` while it is running) has been successfully built and run under
+Cygwin in the past. `chronyd` is not portable, because part of it is
+very system-dependent. It needs adapting to work with Windows'
+equivalent of the adjtimex() call, and it needs to be made to work as a
+service.
+
+=== Are there any plans to support Windows?
+
+We have no plans to do this. Anyone is welcome to pick this work up and
+contribute it back to the project.
diff --git a/doc/installation.adoc b/doc/installation.adoc
new file mode 100644
index 0000000..151674a
--- /dev/null
+++ b/doc/installation.adoc
@@ -0,0 +1,189 @@
+// This file is part of chrony
+//
+// Copyright (C) Richard P. Curnow 1997-2003
+// Copyright (C) Miroslav Lichvar 2009-2016
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of version 2 of the GNU General Public License as
+// published by the Free Software Foundation.
+//
+// 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+= Installation
+
+The software is distributed as source code which has to be compiled. The source
+code is supplied in the form of a gzipped tar file, which unpacks to a
+subdirectory identifying the name and version of the program.
+
+After unpacking the source code, change directory into it, and type
+
+----
+./configure
+----
+
+This is a shell script that automatically determines the system type. There is
+a single optional parameter, `--prefix` which indicates the directory tree
+where the software should be installed. For example,
+
+----
+./configure --prefix=/opt/free
+----
+
+will install the `chronyd` daemon into `/opt/free/sbin` and the `chronyc`
+control program into `/opt/free/bin`. The default value for the prefix is
+`/usr/local`.
+
+The configure script assumes you want to use gcc as your compiler. If you want
+to use a different compiler, you can configure this way:
+
+----
+CC=cc CFLAGS=-O ./configure --prefix=/opt/free
+----
+
+for Bourne-family shells, or
+
+----
+setenv CC cc
+setenv CFLAGS -O
+./configure --prefix=/opt/free
+----
+
+for C-family shells.
+
+If the software cannot (yet) be built on your system, an error message will be
+shown. Otherwise, `Makefile` will be generated.
+
+On Linux, if development files for the libcap library are available, `chronyd`
+will be built with support for dropping root privileges. On other systems no
+extra library is needed. The default user which `chronyd` should run as can be
+specified with the `--with-user` option of the configure script.
+
+If development files for the editline or readline library are available,
+`chronyc` will be built with line editing support. If you don't want this,
+specify the `--disable-readline` flag to configure.
+
+If a `timepps.h` header is available (e.g. from the
+http://linuxpps.org[LinuxPPS project]), `chronyd` will be built with PPS API
+reference clock driver. If the header is installed in a location that isn't
+normally searched by the compiler, you can add it to the searched locations by
+setting the `CPPFLAGS` variable to `-I/path/to/timepps`.
+
+Now type
+
+----
+make
+----
+
+to build the programs.
+
+If you want to build the manual in HTML, type
+
+----
+make docs
+----
+
+Once the programs have been successfully compiled, they need to be installed in
+their target locations. This step normally needs to be performed by the
+superuser, and requires the following command to be entered.
+
+----
+make install
+----
+
+This will install the binaries and man pages.
+
+To install the HTML version of the manual, enter the command
+
+----
+make install-docs
+----
+
+Now that the software is successfully installed, the next step is to set up a
+configuration file. The default location of the file is _/etc/chrony.conf_.
+Several examples of configuration with comments are included in the examples
+directory. Suppose you want to use public NTP servers from the pool.ntp.org
+project as your time reference. A minimal useful configuration file could be
+
+----
+pool pool.ntp.org iburst
+makestep 1.0 3
+rtcsync
+----
+
+Then, `chronyd` can be run. For security reasons, it's recommended to create an
+unprivileged user for `chronyd` and specify it with the `-u` command-line
+option or the `user` directive in the configuration file, or set the default
+user with the `--with-user` configure option before building.
+
+== Support for line editing libraries
+
+`chronyc` can be built with support for line editing, this allows you to use
+the cursor keys to replay and edit old commands. Two libraries are supported
+which provide such functionality, editline and GNU readline.
+
+Please note that readline since version 6.0 is licensed under GPLv3+ which is
+incompatible with chrony's license GPLv2. You should use editline instead if
+you don't want to use older readline versions.
+
+The configure script will automatically enable the line editing support if one
+of the supported libraries is available. If they are both available, the
+editline library will be used.
+
+If you don't want to use it (in which case chronyc will use a minimal command
+line interface), invoke configure like this:
+
+----
+./configure --disable-readline other-options...
+----
+
+If you have editline, readline or ncurses installed in locations that aren't
+normally searched by the compiler and linker, you need to use extra options:
+
+`--with-readline-includes=directory_name`::
+ This defines the name of the directory above the one where `readline.h` is.
+ `readline.h` is assumed to be in `editline` or `readline` subdirectory of the
+ named directory.
+
+`--with-readline-library=directory_name`::
+ This defines the directory containing the `libedit.a` or `libedit.so` file,
+ or `libreadline.a` or `libreadline.so` file.
+
+`--with-ncurses-library=directory_name`::
+ This defines the directory containing the `libncurses.a` or `libncurses.so`
+ file.
+
+== Extra options for package builders
+
+The configure and make procedures have some extra options that may be useful if
+you are building a distribution package for chrony.
+
+The `--mandir=DIR` option to configure specifies an install directory for the
+man pages. This overrides the `man` subdirectory of the argument to the
+--prefix option.
+
+----
+./configure --prefix=/usr --mandir=/usr/share/man
+----
+
+to set both options together.
+
+The final option is the `DESTDIR` option to the make command. For example, you
+could use the commands
+
+----
+./configure --prefix=/usr --mandir=/usr/share/man
+make all docs
+make install DESTDIR=./tmp
+cd tmp
+tar cvf - . | gzip -9 > chrony.tar.gz
+----
+
+to build a package. When untarred within the root directory, this will install
+the files to the intended final locations.
diff --git a/examples/chrony.spec b/examples/chrony.spec
index 362961b..d8f1c14 100644
--- a/examples/chrony.spec
+++ b/examples/chrony.spec
@@ -1,4 +1,4 @@
-%global chrony_version 2.3
+%global chrony_version 2.4
%if 0%(echo %{chrony_version} | grep -q pre && echo 1)
%global prerelease %(echo %{chrony_version} | sed 's/.*-//')
%endif
@@ -10,7 +10,6 @@ Source: chrony-%{version}%{?prerelease:-%{prerelease}}.tar.gz
License: GPLv2
Group: Applications/Utilities
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(id -u -n)
-Requires: info
%description
chrony is a client and server for the Network Time Protocol (NTP).
@@ -28,29 +27,20 @@ manual input as time references.
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--sbindir=%{_sbindir} \
- --infodir=%{_infodir} \
--mandir=%{_mandir}
make
-make chrony.txt
-make chrony.info
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
-rm -rf $RPM_BUILD_ROOT%{_docdir}
-mkdir -p $RPM_BUILD_ROOT%{_infodir}
-cp chrony.info* $RPM_BUILD_ROOT%{_infodir}
%files
%{_sbindir}/chronyd
%{_bindir}/chronyc
-%{_infodir}/chrony.info*
%{_mandir}/man1/chronyc.1.gz
%{_mandir}/man5/chrony.conf.5.gz
%{_mandir}/man8/chronyd.8.gz
-%doc README
-%doc chrony.txt
-%doc COPYING
+%doc README FAQ NEWS COPYING
%doc examples/chrony.conf.example*
%doc examples/chrony.keys.example
diff --git a/local.c b/local.c
index 848cc3e..2ec173e 100644
--- a/local.c
+++ b/local.c
@@ -42,13 +42,12 @@
/* ================================================== */
-/* Maximum allowed frequency offset in ppm, the time must not stop
- or run backwards */
-#define MAX_FREQ 500000.0
-
/* Variable to store the current frequency, in ppm */
static double current_freq_ppm;
+/* Maximum allowed frequency, in ppm */
+static double max_freq_ppm;
+
/* Temperature compensation, in ppm */
static double temp_comp_ppm;
@@ -166,6 +165,11 @@ LCL_Initialise(void)
calculate_sys_precision();
+ /* This is the maximum allowed frequency offset in ppm, the time must
+ never stop or run backwards */
+ max_freq_ppm = CNF_GetMaxDrift();
+ max_freq_ppm = CLAMP(0.0, max_freq_ppm, 500000.0);
+
max_clock_error = CNF_GetMaxClockError() * 1e-6;
}
@@ -406,12 +410,12 @@ LCL_ReadAbsoluteFrequency(void)
static double
clamp_freq(double freq)
{
- if (freq <= MAX_FREQ && freq >= -MAX_FREQ)
+ if (freq <= max_freq_ppm && freq >= -max_freq_ppm)
return freq;
LOG(LOGS_WARN, LOGF_Local, "Frequency %.1f ppm exceeds allowed maximum", freq);
- return freq >= MAX_FREQ ? MAX_FREQ : -MAX_FREQ;
+ return CLAMP(-max_freq_ppm, freq, max_freq_ppm);
}
/* ================================================== */
diff --git a/ntp.h b/ntp.h
index 5a377ef..08a8bf6 100644
--- a/ntp.h
+++ b/ntp.h
@@ -53,8 +53,8 @@ typedef uint32_t NTP_int32;
#define NTP_MAX_EXTENSIONS_LENGTH 1024
/* The minimum and maximum supported length of MAC */
-#define NTP_MIN_MAC_LENGTH 16
-#define NTP_MAX_MAC_LENGTH MAX_HASH_LENGTH
+#define NTP_MIN_MAC_LENGTH (4 + 16)
+#define NTP_MAX_MAC_LENGTH (4 + MAX_HASH_LENGTH)
/* Type definition for leap bits */
typedef enum {
@@ -91,7 +91,7 @@ typedef struct {
/* Optional message authentication code (MAC) */
NTP_int32 auth_keyid;
- uint8_t auth_data[NTP_MAX_MAC_LENGTH];
+ uint8_t auth_data[NTP_MAX_MAC_LENGTH - 4];
} NTP_Packet;
#define NTP_NORMAL_PACKET_LENGTH (int)offsetof(NTP_Packet, auth_keyid)
diff --git a/ntp_core.c b/ntp_core.c
index f13ea16..7942693 100644
--- a/ntp_core.c
+++ b/ntp_core.c
@@ -602,6 +602,7 @@ NCR_ChangeRemoteAddress(NCR_Instance inst, NTP_Remote_Address *remote_addr)
close_client_socket(inst);
else {
NIO_CloseServerSocket(inst->local_addr.sock_fd);
+ inst->local_addr.ip_addr.family = IPADDR_UNSPEC;
inst->local_addr.sock_fd = NIO_OpenServerSocket(remote_addr);
}
@@ -800,7 +801,7 @@ transmit_packet(NTP_Mode my_mode, /* The mode this machine wants to be */
)
{
NTP_Packet message;
- int leap, auth_len, length, ret, precision;
+ int auth_len, length, ret, precision;
struct timeval local_receive, local_transmit;
NTP_int64 ts_fuzz;
@@ -822,7 +823,7 @@ transmit_packet(NTP_Mode my_mode, /* The mode this machine wants to be */
if (my_mode == MODE_CLIENT) {
/* Don't reveal local time or state of the clock in client packets */
precision = 32;
- are_we_synchronised = leap_status = our_stratum = our_ref_id = 0;
+ leap_status = our_stratum = our_ref_id = 0;
our_ref_time.tv_sec = our_ref_time.tv_usec = 0;
our_root_delay = our_root_dispersion = 0.0;
} else {
@@ -858,14 +859,8 @@ transmit_packet(NTP_Mode my_mode, /* The mode this machine wants to be */
local_receive = *local_rx;
}
- if (are_we_synchronised) {
- leap = (int) leap_status;
- } else {
- leap = LEAP_Unsynchronised;
- }
-
/* Generate transmit packet */
- message.lvm = NTP_LVM(leap, version, my_mode);
+ message.lvm = NTP_LVM(leap_status, version, my_mode);
/* Stratum 16 and larger are invalid */
if (our_stratum < NTP_MAX_STRATUM) {
message.stratum = our_stratum;
@@ -961,6 +956,7 @@ static void
transmit_timeout(void *arg)
{
NCR_Instance inst = (NCR_Instance) arg;
+ NTP_Local_Address local_addr;
int sent;
inst->tx_timeout_id = 0;
@@ -996,6 +992,10 @@ transmit_timeout(void *arg)
inst->local_addr.sock_fd = NIO_OpenClientSocket(&inst->remote_addr);
}
+ /* Don't require the packet to be sent from the same address as before */
+ local_addr.ip_addr.family = IPADDR_UNSPEC;
+ local_addr.sock_fd = inst->local_addr.sock_fd;
+
/* Check whether we need to 'warm up' the link to the other end by
sending an NTP exchange to ensure both ends' ARP caches are
primed. On loaded systems this might also help ensure that bits
@@ -1009,7 +1009,7 @@ transmit_timeout(void *arg)
as the reply will be ignored */
transmit_packet(MODE_CLIENT, inst->local_poll, inst->version, 0, 0,
&inst->remote_orig, &inst->local_rx, NULL, NULL,
- &inst->remote_addr, &inst->local_addr);
+ &inst->remote_addr, &local_addr);
inst->presend_done = 1;
@@ -1027,7 +1027,7 @@ transmit_timeout(void *arg)
&inst->remote_orig,
&inst->local_rx, &inst->local_tx, &inst->local_ntp_tx,
&inst->remote_addr,
- &inst->local_addr);
+ &local_addr);
++inst->tx_count;
@@ -1184,7 +1184,6 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
/* These are the timeval equivalents of the remote epochs */
struct timeval remote_receive_tv, remote_transmit_tv;
- struct timeval remote_reference_tv;
struct timeval local_average, remote_average;
double local_interval, remote_interval;
@@ -1223,7 +1222,6 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
UTI_Int64ToTimeval(&message->receive_ts, &remote_receive_tv);
UTI_Int64ToTimeval(&message->transmit_ts, &remote_transmit_tv);
- UTI_Int64ToTimeval(&message->reference_ts, &remote_reference_tv);
/* Check if the packet is valid per RFC 5905, section 8.
The test values are 1 when passed and 0 when failed. */
@@ -1241,7 +1239,6 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
association if not properly 'up'. */
test3 = (message->originate_ts.hi || message->originate_ts.lo) &&
(message->receive_ts.hi || message->receive_ts.lo) &&
- (message->reference_ts.hi || message->reference_ts.lo) &&
(message->transmit_ts.hi || message->transmit_ts.lo);
/* Test 4 would check for denied access. It would always pass as this
@@ -1262,10 +1259,8 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
message->stratum != NTP_INVALID_STRATUM;
/* Test 7 checks for bad data. The root distance must be smaller than a
- defined maximum and the transmit time must not be before the time of
- the last synchronisation update. */
- test7 = pkt_root_delay / 2.0 + pkt_root_dispersion < NTP_MAX_DISPERSION &&
- UTI_CompareTimevals(&remote_reference_tv, &remote_transmit_tv) < 1;
+ defined maximum. */
+ test7 = pkt_root_delay / 2.0 + pkt_root_dispersion < NTP_MAX_DISPERSION;
/* The packet is considered valid if the tests above passed */
valid_packet = test1 && test2 && test3 && test5 && test6 && test7;
@@ -1353,7 +1348,8 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
/* Test D requires that the remote peer is not synchronised to us to
prevent a synchronisation loop */
- testD = message->stratum <= 1 || pkt_refid != UTI_IPToRefid(&local_addr->ip_addr);
+ testD = message->stratum <= 1 || REF_GetMode() != REF_ModeNormal ||
+ pkt_refid != UTI_IPToRefid(&local_addr->ip_addr);
} else {
offset = delay = dispersion = 0.0;
sample_time = *now;
@@ -1450,6 +1446,9 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
server and the socket can be closed */
close_client_socket(inst);
+ /* Update the local address */
+ inst->local_addr.ip_addr = local_addr->ip_addr;
+
requeue_transmit = 1;
}
@@ -2008,6 +2007,14 @@ NCR_GetRemoteAddress(NCR_Instance inst)
/* ================================================== */
+uint32_t
+NCR_GetLocalRefid(NCR_Instance inst)
+{
+ return UTI_IPToRefid(&inst->local_addr.ip_addr);
+}
+
+/* ================================================== */
+
int NCR_IsSyncPeer(NCR_Instance inst)
{
return SRC_IsSyncPeer(inst->source);
diff --git a/ntp_core.h b/ntp_core.h
index db624e1..d0af70f 100644
--- a/ntp_core.h
+++ b/ntp_core.h
@@ -105,6 +105,8 @@ extern void NCR_IncrementActivityCounters(NCR_Instance inst, int *online, int *o
extern NTP_Remote_Address *NCR_GetRemoteAddress(NCR_Instance instance);
+extern uint32_t NCR_GetLocalRefid(NCR_Instance inst);
+
extern int NCR_IsSyncPeer(NCR_Instance instance);
extern void NCR_AddBroadcastDestination(IPAddr *addr, unsigned short port, int interval);
diff --git a/ntp_io.c b/ntp_io.c
index 4c250ae..cf087de 100644
--- a/ntp_io.c
+++ b/ntp_io.c
@@ -162,21 +162,21 @@ prepare_socket(int family, int port_number, int client_only)
/* Make the socket capable of re-using an old address if binding to a specific port */
if (port_number &&
setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on_off, sizeof(on_off)) < 0) {
- LOG(LOGS_ERR, LOGF_NtpIO, "Could not set reuseaddr socket options");
+ LOG(LOGS_ERR, LOGF_NtpIO, "Could not set %s socket option", "SO_REUSEADDR");
/* Don't quit - we might survive anyway */
}
/* Make the socket capable of sending broadcast pkts - needed for NTP broadcast mode */
if (!client_only &&
setsockopt(sock_fd, SOL_SOCKET, SO_BROADCAST, (char *)&on_off, sizeof(on_off)) < 0) {
- LOG(LOGS_ERR, LOGF_NtpIO, "Could not set broadcast socket options");
+ LOG(LOGS_ERR, LOGF_NtpIO, "Could not set %s socket option", "SO_BROADCAST");
/* Don't quit - we might survive anyway */
}
#ifdef SO_TIMESTAMP
/* Enable receiving of timestamp control messages */
if (setsockopt(sock_fd, SOL_SOCKET, SO_TIMESTAMP, (char *)&on_off, sizeof(on_off)) < 0) {
- LOG(LOGS_ERR, LOGF_NtpIO, "Could not set timestamp socket options");
+ LOG(LOGS_ERR, LOGF_NtpIO, "Could not set %s socket option", "SO_TIMESTAMP");
/* Don't quit - we might survive anyway */
}
#endif
@@ -185,7 +185,7 @@ prepare_socket(int family, int port_number, int client_only)
/* Allow binding to address that doesn't exist yet */
if (my_addr_len > 0 &&
setsockopt(sock_fd, IPPROTO_IP, IP_FREEBIND, (char *)&on_off, sizeof(on_off)) < 0) {
- LOG(LOGS_ERR, LOGF_NtpIO, "Could not set free bind socket option");
+ LOG(LOGS_ERR, LOGF_NtpIO, "Could not set %s socket option", "IP_FREEBIND");
}
#endif
@@ -193,7 +193,7 @@ prepare_socket(int family, int port_number, int client_only)
#ifdef HAVE_IN_PKTINFO
/* We want the local IP info on server sockets */
if (setsockopt(sock_fd, IPPROTO_IP, IP_PKTINFO, (char *)&on_off, sizeof(on_off)) < 0) {
- LOG(LOGS_ERR, LOGF_NtpIO, "Could not set packet info socket option");
+ LOG(LOGS_ERR, LOGF_NtpIO, "Could not set %s socket option", "IP_PKTINFO");
/* Don't quit - we might survive anyway */
}
#endif
@@ -203,18 +203,18 @@ prepare_socket(int family, int port_number, int client_only)
#ifdef IPV6_V6ONLY
/* Receive IPv6 packets only */
if (setsockopt(sock_fd, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&on_off, sizeof(on_off)) < 0) {
- LOG(LOGS_ERR, LOGF_NtpIO, "Could not set IPV6_V6ONLY socket option");
+ LOG(LOGS_ERR, LOGF_NtpIO, "Could not set %s socket option", "IPV6_V6ONLY");
}
#endif
#ifdef HAVE_IN6_PKTINFO
#ifdef IPV6_RECVPKTINFO
if (setsockopt(sock_fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, (char *)&on_off, sizeof(on_off)) < 0) {
- LOG(LOGS_ERR, LOGF_NtpIO, "Could not set IPv6 packet info socket option");
+ LOG(LOGS_ERR, LOGF_NtpIO, "Could not set %s socket option", "IPV6_RECVPKTINFO");
}
#else
if (setsockopt(sock_fd, IPPROTO_IPV6, IPV6_PKTINFO, (char *)&on_off, sizeof(on_off)) < 0) {
- LOG(LOGS_ERR, LOGF_NtpIO, "Could not set IPv6 packet info socket option");
+ LOG(LOGS_ERR, LOGF_NtpIO, "Could not set %s socket option", "IPV6_PKTINFO");
}
#endif
#endif
diff --git a/ntp_sources.c b/ntp_sources.c
index 96fb142..dbd4748 100644
--- a/ntp_sources.c
+++ b/ntp_sources.c
@@ -3,7 +3,7 @@
**********************************************************************
* Copyright (C) Richard P. Curnow 1997-2003
- * Copyright (C) Miroslav Lichvar 2011-2012, 2014
+ * Copyright (C) Miroslav Lichvar 2011-2012, 2014, 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
@@ -53,8 +53,7 @@ typedef struct {
int pool; /* Number of the pool from which was this source
added or INVALID_POOL */
int tentative; /* Flag indicating there was no valid response
- yet and the source may be removed if other
- sources from the pool respond first */
+ received from the source yet */
} SourceRecord;
/* Hash table of SourceRecord, its size is a power of two and it's never
@@ -71,6 +70,7 @@ static int auto_start_sources = 0;
struct UnresolvedSource {
char *name;
int port;
+ int random_order;
int replacement;
union {
struct {
@@ -311,7 +311,7 @@ add_source(NTP_Remote_Address *remote_addr, char *name, NTP_Source_Type type, So
record->remote_addr = NCR_GetRemoteAddress(record->data);
record->name = name ? Strdup(name) : NULL;
record->pool = pool;
- record->tentative = pool != INVALID_POOL ? 1 : 0;
+ record->tentative = 1;
if (auto_start_sources)
NCR_StartInstance(record->data);
@@ -328,6 +328,7 @@ replace_source(NTP_Remote_Address *old_addr, NTP_Remote_Address *new_addr)
{
int slot1, slot2, found;
SourceRecord *record;
+ struct SourcePool *pool;
find_slot(old_addr, &slot1, &found);
if (!found)
@@ -341,6 +342,15 @@ replace_source(NTP_Remote_Address *old_addr, NTP_Remote_Address *new_addr)
NCR_ChangeRemoteAddress(record->data, new_addr);
record->remote_addr = NCR_GetRemoteAddress(record->data);
+ if (!record->tentative) {
+ record->tentative = 1;
+
+ if (record->pool != INVALID_POOL) {
+ pool = ARR_GetElement(pools, record->pool);
+ pool->sources--;
+ }
+ }
+
/* The hash table must be rebuilt for the new address */
rehash_records();
@@ -358,13 +368,17 @@ process_resolved_name(struct UnresolvedSource *us, IPAddr *ip_addrs, int n_addrs
{
NTP_Remote_Address address;
int i, added;
+ unsigned short first = 0;
- for (i = added = 0; i < n_addrs; i++) {
- DEBUG_LOG(LOGF_NtpSources, "(%d) %s", i + 1, UTI_IPToString(&ip_addrs[i]));
+ if (us->random_order)
+ UTI_GetRandomBytes(&first, sizeof (first));
- address.ip_addr = ip_addrs[i];
+ for (i = added = 0; i < n_addrs; i++) {
+ address.ip_addr = ip_addrs[((unsigned int)i + first) % n_addrs];
address.port = us->port;
+ DEBUG_LOG(LOGF_NtpSources, "(%d) %s", i + 1, UTI_IPToString(&address.ip_addr));
+
if (us->replacement) {
if (replace_source(&us->replace_source, &address) != NSR_AlreadyInUse)
break;
@@ -507,6 +521,7 @@ NSR_AddSourceByName(char *name, int port, int pool, NTP_Source_Type type, Source
us = MallocNew(struct UnresolvedSource);
us->name = Strdup(name);
us->port = port;
+ us->random_order = 0;
us->replacement = 0;
us->new_source.type = type;
us->new_source.params = *params;
@@ -648,6 +663,11 @@ resolve_source_replacement(SourceRecord *record)
us = MallocNew(struct UnresolvedSource);
us->name = Strdup(record->name);
us->port = record->remote_addr->port;
+ /* If there never was a valid reply from this source (e.g. it was a bad
+ replacement), ignore the order of addresses from the resolver to not get
+ stuck to a pair of addresses if the order doesn't change, or a group of
+ IPv4/IPv6 addresses if the resolver prefers inaccessible IP family */
+ us->random_order = record->tentative;
us->replacement = 1;
us->replace_source = *record->remote_addr;
@@ -733,6 +753,26 @@ static void remove_tentative_pool_sources(int pool)
rehash_records();
}
+/* ================================================== */
+
+uint32_t
+NSR_GetLocalRefid(IPAddr *address)
+{
+ NTP_Remote_Address remote_addr;
+ int slot, found;
+
+ remote_addr.ip_addr = *address;
+ remote_addr.port = 0;
+
+ find_slot(&remote_addr, &slot, &found);
+ if (!found)
+ return 0;
+
+ return NCR_GetLocalRefid(get_record(slot)->data);
+}
+
+/* ================================================== */
+
/* This routine is called by ntp_io when a new packet arrives off the network,
possibly with an authentication tail */
void
@@ -752,20 +792,21 @@ NSR_ProcessReceive(NTP_Packet *message, struct timeval *now, double now_err, NTP
return;
if (record->tentative) {
- /* First reply from a pool source */
+ /* This was the first valid reply from the source */
record->tentative = 0;
- assert(record->pool != INVALID_POOL);
- pool = (struct SourcePool *)ARR_GetElement(pools, record->pool);
- pool->sources++;
+ if (record->pool != INVALID_POOL) {
+ pool = ARR_GetElement(pools, record->pool);
+ pool->sources++;
- DEBUG_LOG(LOGF_NtpSources, "pool %s has %d confirmed sources",
- record->name, pool->sources);
+ DEBUG_LOG(LOGF_NtpSources, "pool %s has %d confirmed sources",
+ record->name, pool->sources);
- /* If the number of sources reached the configured maximum, remove
- the tentative sources added from this pool */
- if (pool->sources >= pool->max_sources)
- remove_tentative_pool_sources(record->pool);
+ /* If the number of sources from the pool reached the configured
+ maximum, remove the remaining tentative sources */
+ if (pool->sources >= pool->max_sources)
+ remove_tentative_pool_sources(record->pool);
+ }
}
} else {
NCR_ProcessUnknown(message, now, now_err, remote_addr, local_addr, length);
diff --git a/ntp_sources.h b/ntp_sources.h
index 9bd2d3b..4d9bbbe 100644
--- a/ntp_sources.h
+++ b/ntp_sources.h
@@ -83,6 +83,9 @@ extern void NSR_HandleBadSource(IPAddr *address);
/* Procedure to resolve all names again */
extern void NSR_RefreshAddresses(void);
+/* Procedure to get local reference ID corresponding to a source */
+extern uint32_t NSR_GetLocalRefid(IPAddr *address);
+
/* This routine is called by ntp_io when a new packet arrives off the network */
extern void NSR_ProcessReceive(NTP_Packet *message, struct timeval *now, double now_err, NTP_Remote_Address *remote_addr, NTP_Local_Address *local_addr, int length);
diff --git a/pktlength.c b/pktlength.c
index 0774565..7366e51 100644
--- a/pktlength.c
+++ b/pktlength.c
@@ -67,7 +67,7 @@ static const struct request_length request_lengths[] = {
REQ_LENGTH_ENTRY(modify_maxupdateskew, null), /* MODIFY_MAXUPDATESKEW */
REQ_LENGTH_ENTRY(logon, null), /* LOGON */
REQ_LENGTH_ENTRY(settime, manual_timestamp), /* SETTIME */
- REQ_LENGTH_ENTRY(local, null), /* LOCAL */
+ { 0, 0 }, /* LOCAL */
REQ_LENGTH_ENTRY(manual, null), /* MANUAL */
REQ_LENGTH_ENTRY(null, n_sources), /* N_SOURCES */
REQ_LENGTH_ENTRY(source_data, source_data), /* SOURCE_DATA */
@@ -112,6 +112,7 @@ static const struct request_length request_lengths[] = {
REQ_LENGTH_ENTRY(null, server_stats), /* SERVER_STATS */
REQ_LENGTH_ENTRY(client_accesses_by_index,
client_accesses_by_index), /* CLIENT_ACCESSES_BY_INDEX2 */
+ REQ_LENGTH_ENTRY(local, null), /* LOCAL2 */
};
static const uint16_t reply_lengths[] = {
diff --git a/refclock.c b/refclock.c
index 86c0de2..7ee1468 100644
--- a/refclock.c
+++ b/refclock.c
@@ -87,7 +87,7 @@ struct RCL_Instance_Record {
SRC_Instance source;
};
-/* Array of RCL_Instance_Record */
+/* Array of pointers to RCL_Instance_Record */
static ARR_Instance refclocks;
static LOG_FileID logfileid;
@@ -114,13 +114,13 @@ static void filter_add_dispersion(struct MedianFilter *filter, double dispersion
static RCL_Instance
get_refclock(unsigned int index)
{
- return (RCL_Instance)ARR_GetElement(refclocks, index);
+ return *(RCL_Instance *)ARR_GetElement(refclocks, index);
}
void
RCL_Initialise(void)
{
- refclocks = ARR_CreateInstance(sizeof (struct RCL_Instance_Record));
+ refclocks = ARR_CreateInstance(sizeof (RCL_Instance));
CNF_AddRefclocks();
@@ -148,6 +148,7 @@ RCL_Finalise(void)
filter_fini(&inst->filter);
Free(inst->driver_parameter);
SRC_DestroyInstance(inst->source);
+ Free(inst);
}
if (ARR_GetSize(refclocks) > 0) {
@@ -162,8 +163,10 @@ int
RCL_AddRefclock(RefclockParameters *params)
{
int pps_source = 0;
+ RCL_Instance inst;
- RCL_Instance inst = ARR_GetNewElement(refclocks);
+ inst = MallocNew(struct RCL_Instance_Record);
+ *(RCL_Instance *)ARR_GetNewElement(refclocks) = inst;
if (strcmp(params->driver_name, "SHM") == 0) {
inst->driver = &RCL_SHM_driver;
@@ -470,15 +473,16 @@ RCL_AddPulse(RCL_Instance instance, struct timeval *pulse_time, double second)
double root_delay, root_dispersion, distance;
uint32_t ref_id;
- /* Ignore the pulse if we are not well synchronized */
+ /* Ignore the pulse if we are not well synchronized and the local
+ reference is not active */
REF_GetReferenceParams(&cooked_time, &is_synchronised, &leap, &stratum,
&ref_id, &ref_time, &root_delay, &root_dispersion);
distance = fabs(root_delay) / 2 + root_dispersion;
- if (!is_synchronised || distance >= 0.5 / rate) {
+ if (leap == LEAP_Unsynchronised || distance >= 0.5 / rate) {
DEBUG_LOG(LOGF_Refclock, "refclock pulse ignored second=%.9f sync=%d dist=%.9f",
- second, is_synchronised, distance);
+ second, leap != LEAP_Unsynchronised, distance);
/* Drop also all stored samples */
filter_reset(&instance->filter);
return 0;
@@ -528,9 +532,10 @@ pps_stratum(RCL_Instance instance, struct timeval *tv)
REF_GetReferenceParams(tv, &is_synchronised, &leap, &stratum,
&ref_id, &ref_time, &root_delay, &root_dispersion);
- /* Don't change our stratum if local stratum is active
+ /* Don't change our stratum if the local reference is active
or this is the current source */
- if (ref_id == instance->ref_id || REF_IsLocalActive())
+ if (ref_id == instance->ref_id ||
+ (!is_synchronised && leap != LEAP_Unsynchronised))
return stratum - 1;
/* Or the current source is another PPS refclock */
diff --git a/reference.c b/reference.c
index f9b4ad4..1700186 100644
--- a/reference.c
+++ b/reference.c
@@ -3,7 +3,7 @@
**********************************************************************
* Copyright (C) Richard P. Curnow 1997-2003
- * Copyright (C) Miroslav Lichvar 2009-2015
+ * Copyright (C) Miroslav Lichvar 2009-2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
@@ -45,6 +45,8 @@
static int are_we_synchronised;
static int enable_local_stratum;
static int local_stratum;
+static int local_orphan;
+static double local_distance;
static NTP_Leap our_leap_status;
static int our_leap_sec;
static int our_stratum;
@@ -230,7 +232,7 @@ REF_Initialise(void)
correction_time_ratio = CNF_GetCorrectionTimeRatio();
- enable_local_stratum = CNF_AllowLocalReference(&local_stratum);
+ enable_local_stratum = CNF_AllowLocalReference(&local_stratum, &local_orphan, &local_distance);
leap_timeout_id = 0;
leap_in_progress = 0;
@@ -1157,29 +1159,37 @@ REF_GetReferenceParams
double *root_dispersion
)
{
- double elapsed;
- double extra_dispersion;
+ double elapsed, dispersion;
assert(initialised);
if (are_we_synchronised) {
+ UTI_DiffTimevalsToDouble(&elapsed, local_time, &our_ref_time);
+ dispersion = our_root_dispersion +
+ (our_skew + fabs(our_residual_freq) + LCL_GetMaxClockError()) * elapsed;
+ } else {
+ dispersion = 0.0;
+ }
+
+ /* Local reference is active when enabled and the clock is not synchronised
+ or the root distance exceeds the threshold */
+
+ if (are_we_synchronised &&
+ !(enable_local_stratum && our_root_delay / 2 + dispersion > local_distance)) {
*is_synchronised = 1;
*stratum = our_stratum;
- UTI_DiffTimevalsToDouble(&elapsed, local_time, &our_ref_time);
- extra_dispersion = (our_skew + fabs(our_residual_freq) + LCL_GetMaxClockError()) * elapsed;
-
*leap_status = !leap_in_progress ? our_leap_status : LEAP_Unsynchronised;
*ref_id = our_ref_id;
*ref_time = our_ref_time;
*root_delay = our_root_delay;
- *root_dispersion = our_root_dispersion + extra_dispersion;
+ *root_dispersion = dispersion;
} else if (enable_local_stratum) {
- *is_synchronised = 1;
+ *is_synchronised = 0;
*stratum = local_stratum;
*ref_id = NTP_REFID_LOCAL;
@@ -1220,13 +1230,27 @@ REF_GetReferenceParams
int
REF_GetOurStratum(void)
{
- if (are_we_synchronised) {
- return our_stratum;
- } else if (enable_local_stratum) {
- return local_stratum;
- } else {
+ struct timeval now_cooked, ref_time;
+ int synchronised, stratum;
+ NTP_Leap leap_status;
+ uint32_t ref_id;
+ double root_delay, root_dispersion;
+
+ SCH_GetLastEventTime(&now_cooked, NULL, NULL);
+ REF_GetReferenceParams(&now_cooked, &synchronised, &leap_status, &stratum,
+ &ref_id, &ref_time, &root_delay, &root_dispersion);
+
+ return stratum;
+}
+
+/* ================================================== */
+
+int
+REF_GetOrphanStratum(void)
+{
+ if (!enable_local_stratum || !local_orphan || mode != REF_ModeNormal)
return NTP_MAX_STRATUM;
- }
+ return local_stratum;
}
/* ================================================== */
@@ -1257,10 +1281,12 @@ REF_ModifyMakestep(int limit, double threshold)
/* ================================================== */
void
-REF_EnableLocal(int stratum)
+REF_EnableLocal(int stratum, double distance, int orphan)
{
enable_local_stratum = 1;
- local_stratum = stratum;
+ local_stratum = CLAMP(1, stratum, NTP_MAX_STRATUM - 1);
+ local_distance = distance;
+ local_orphan = !!orphan;
}
/* ================================================== */
@@ -1273,14 +1299,6 @@ REF_DisableLocal(void)
/* ================================================== */
-int
-REF_IsLocalActive(void)
-{
- return !are_we_synchronised && enable_local_stratum;
-}
-
-/* ================================================== */
-
#define LEAP_SECOND_CLOSE 5
int REF_IsLeapSecondClose(void)
@@ -1309,52 +1327,34 @@ int REF_IsLeapSecondClose(void)
void
REF_GetTrackingReport(RPT_TrackingReport *rep)
{
- double elapsed;
- double extra_dispersion;
struct timeval now_raw, now_cooked;
double correction;
+ int synchronised;
LCL_ReadRawTime(&now_raw);
LCL_GetOffsetCorrection(&now_raw, &correction, NULL);
UTI_AddDoubleToTimeval(&now_raw, correction, &now_cooked);
- rep->ref_id = NTP_REFID_UNSYNC;
+ REF_GetReferenceParams(&now_cooked, &synchronised,
+ &rep->leap_status, &rep->stratum,
+ &rep->ref_id, &rep->ref_time,
+ &rep->root_delay, &rep->root_dispersion);
+
+ if (rep->stratum == NTP_MAX_STRATUM)
+ rep->stratum = 0;
+
rep->ip_addr.family = IPADDR_UNSPEC;
- rep->stratum = 0;
- rep->leap_status = our_leap_status;
- rep->ref_time.tv_sec = 0;
- rep->ref_time.tv_usec = 0;
rep->current_correction = correction;
rep->freq_ppm = LCL_ReadAbsoluteFrequency();
rep->resid_freq_ppm = 0.0;
rep->skew_ppm = 0.0;
- rep->root_delay = 0.0;
- rep->root_dispersion = 0.0;
rep->last_update_interval = last_ref_update_interval;
rep->last_offset = last_offset;
rep->rms_offset = sqrt(avg2_offset);
- if (are_we_synchronised) {
-
- UTI_DiffTimevalsToDouble(&elapsed, &now_cooked, &our_ref_time);
- extra_dispersion = (our_skew + fabs(our_residual_freq) + LCL_GetMaxClockError()) * elapsed;
-
- rep->ref_id = our_ref_id;
+ if (synchronised) {
rep->ip_addr = our_ref_ip;
- rep->stratum = our_stratum;
- rep->ref_time = our_ref_time;
rep->resid_freq_ppm = 1.0e6 * our_residual_freq;
rep->skew_ppm = 1.0e6 * our_skew;
- rep->root_delay = our_root_delay;
- rep->root_dispersion = our_root_dispersion + extra_dispersion;
-
- } else if (enable_local_stratum) {
-
- rep->ref_id = NTP_REFID_LOCAL;
- rep->ip_addr.family = IPADDR_UNSPEC;
- rep->stratum = local_stratum;
- rep->ref_time = now_cooked;
- rep->root_dispersion = LCL_GetSysPrecisionAsQuantum();
}
-
}
diff --git a/reference.h b/reference.h
index 6ffc97d..e4387b0 100644
--- a/reference.h
+++ b/reference.h
@@ -165,6 +165,9 @@ REF_SetUnsynchronised(void);
synchronised */
extern int REF_GetOurStratum(void);
+/* Return stratum of the local reference if orphan mode is enabled */
+extern int REF_GetOrphanStratum(void);
+
/* Return the current skew */
extern double REF_GetSkew(void);
@@ -174,9 +177,8 @@ extern void REF_ModifyMaxupdateskew(double new_max_update_skew);
/* Modify makestep settings */
extern void REF_ModifyMakestep(int limit, double threshold);
-extern void REF_EnableLocal(int stratum);
+extern void REF_EnableLocal(int stratum, double distance, int orphan);
extern void REF_DisableLocal(void);
-extern int REF_IsLocalActive(void);
/* Check if current raw or cooked time is close to a leap second
and is better to discard any measurements */
diff --git a/reports.h b/reports.h
index 193d933..7d5d431 100644
--- a/reports.h
+++ b/reports.h
@@ -29,6 +29,7 @@
#include "sysincl.h"
#include "addressing.h"
+#include "ntp.h"
#define REPORT_INVALID_OFFSET 0x80000000
@@ -50,8 +51,8 @@ typedef struct {
typedef struct {
uint32_t ref_id;
IPAddr ip_addr;
- unsigned long stratum;
- unsigned long leap_status;
+ int stratum;
+ NTP_Leap leap_status;
struct timeval ref_time;
double current_correction;
double last_offset;
diff --git a/sched.c b/sched.c
index 78016de..bab926a 100644
--- a/sched.c
+++ b/sched.c
@@ -179,7 +179,8 @@ SCH_AddInputFileHandler
/* Don't want to allow the same fd to register a handler more than
once without deleting a previous association - this suggests
a bug somewhere else in the program. */
- assert(!FD_ISSET(fd, &read_fds));
+ if (FD_ISSET(fd, &read_fds))
+ assert(0);
++n_read_fds;
@@ -208,7 +209,8 @@ SCH_RemoveInputFileHandler(int fd)
assert(initialised);
/* Check that a handler was registered for the fd in question */
- assert(FD_ISSET(fd, &read_fds));
+ if (!FD_ISSET(fd, &read_fds))
+ assert(0);
--n_read_fds;
@@ -717,7 +719,6 @@ SCH_MainLoop(void)
void
SCH_QuitProgram(void)
{
- assert(initialised);
need_to_exit = 1;
}
diff --git a/sources.c b/sources.c
index 04bd36b..79f72cf 100644
--- a/sources.c
+++ b/sources.c
@@ -73,6 +73,7 @@ typedef enum {
SRC_BAD_DISTANCE, /* Has root distance longer than allowed maximum */
SRC_WAITS_STATS, /* Others have bad stats, selection postponed */
SRC_STALE, /* Has older samples than others */
+ SRC_ORPHAN, /* Has stratum equal or larger than orphan stratum */
SRC_FALSETICKER, /* Doesn't agree with others */
SRC_JITTERY, /* Scatter worse than other's dispersion (not used) */
SRC_WAITS_SOURCES, /* Not enough sources, selection postponed */
@@ -429,9 +430,11 @@ SRC_UpdateReachability(SRC_Instance inst, int reachable)
REF_SetUnsynchronised();
}
- /* Try to replace NTP sources that are unreachable or falsetickers */
- if (inst->type == SRC_NTP && (inst->status == SRC_FALSETICKER ||
- (!inst->reachability && inst->reachability_size == SOURCE_REACH_BITS))) {
+ /* Try to replace NTP sources that are unreachable, falsetickers, or
+ have root distance larger than the allowed maximum */
+ if (inst->type == SRC_NTP &&
+ ((!inst->reachability && inst->reachability_size == SOURCE_REACH_BITS) ||
+ inst->status == SRC_FALSETICKER || inst->status == SRC_BAD_DISTANCE)) {
NSR_HandleBadSource(inst->ip_addr);
}
}
@@ -605,6 +608,7 @@ SRC_SelectSource(SRC_Instance updated_inst)
int n_badstats_sources, max_sel_reach, max_badstat_reach, sel_req_source;
int depth, best_depth, trust_depth, best_trust_depth;
int combined, stratum, min_stratum, max_score_index;
+ int orphan_stratum, orphan_source;
double src_offset, src_offset_sd, src_frequency, src_skew;
double src_root_delay, src_root_dispersion;
double best_lo, best_hi, distance, sel_src_distance, max_score;
@@ -678,6 +682,9 @@ SRC_SelectSource(SRC_Instance updated_inst)
max_sel_reach = sources[i]->reachability;
}
+ orphan_stratum = REF_GetOrphanStratum();
+ orphan_source = INVALID_SOURCE;
+
for (i = 0; i < n_sources; i++) {
if (sources[i]->status != SRC_OK)
continue;
@@ -692,7 +699,56 @@ SRC_SelectSource(SRC_Instance updated_inst)
continue;
}
+ /* When the local reference is configured with the orphan option, NTP
+ sources that have stratum equal to the configured local stratum are
+ considered to be orphans (i.e. serving local time while not being
+ synchronised with real time) and are excluded from the normal source
+ selection. Sources with stratum larger than the local stratum are
+ considered to be directly on indirectly synchronised to an orphan and
+ are always ignored.
+
+ If no selectable source is available and all orphan sources have
+ reference IDs larger than the local ID, no source will be selected and
+ the local reference mode will be activated at some point, i.e. this host
+ will become an orphan. Otherwise, the orphan source with the smallest
+ reference ID will be selected. This ensures a group of servers polling
+ each other (with the same orphan configuration) which have no external
+ source can settle down to a state where only one server is serving its
+ local unsychronised time and others are synchronised to it. */
+
+ if (si->stratum >= orphan_stratum && sources[i]->type == SRC_NTP) {
+ sources[i]->status = SRC_ORPHAN;
+
+ if (si->stratum == orphan_stratum && sources[i]->reachability &&
+ (orphan_source == INVALID_SOURCE ||
+ sources[i]->ref_id < sources[orphan_source]->ref_id))
+ orphan_source = i;
+
+ continue;
+ }
+
++n_sel_sources;
+ }
+
+ /* If no selectable source is available, consider the orphan source */
+ if (!n_sel_sources && orphan_source != INVALID_SOURCE) {
+ uint32_t local_ref_id = NSR_GetLocalRefid(sources[orphan_source]->ip_addr);
+
+ if (!local_ref_id) {
+ LOG(LOGS_ERR, LOGF_Sources, "Unknown local refid in orphan mode");
+ } else if (sources[orphan_source]->ref_id < local_ref_id) {
+ sources[orphan_source]->status = SRC_OK;
+ n_sel_sources = 1;
+ DEBUG_LOG(LOGF_Sources, "selecting orphan refid=%"PRIx32,
+ sources[orphan_source]->ref_id);
+ }
+ }
+
+ for (i = 0; i < n_sources; i++) {
+ if (sources[i]->status != SRC_OK)
+ continue;
+
+ si = &sources[i]->sel_info;
j1 = n_endpoints;
j2 = j1 + 1;
@@ -1252,6 +1308,7 @@ SRC_ReportSource(int index, RPT_SourceReport *report, struct timeval *now)
case SRC_BAD_STATS:
case SRC_BAD_DISTANCE:
case SRC_STALE:
+ case SRC_ORPHAN:
case SRC_WAITS_STATS:
report->state = RPT_UNREACH;
break;
diff --git a/stubs.c b/stubs.c
index ac337e8..a5e50b6 100644
--- a/stubs.c
+++ b/stubs.c
@@ -230,6 +230,12 @@ NSR_InitiateSampleBurst(int n_good_samples, int n_total_samples,
return 0;
}
+uint32_t
+NSR_GetLocalRefid(IPAddr *address)
+{
+ return 0;
+}
+
int
NSR_TakeSourcesOnline(IPAddr *mask, IPAddr *address)
{
diff --git a/sys_linux.c b/sys_linux.c
index 8004771..c802da9 100644
--- a/sys_linux.c
+++ b/sys_linux.c
@@ -50,6 +50,7 @@
#ifdef FEAT_SCFILTER
#include <sys/prctl.h>
#include <seccomp.h>
+#include <termios.h>
#ifdef FEAT_PHC
#include <linux/ptp_clock.h>
#endif
diff --git a/test/simulation/105-ntpauth b/test/simulation/105-ntpauth
index 1b9dd48..5cfdf32 100755
--- a/test/simulation/105-ntpauth
+++ b/test/simulation/105-ntpauth
@@ -4,17 +4,40 @@
test_start "NTP authentication"
-server_conf="keyfile tmp/keys"
-client_conf="keyfile tmp/keys"
-
-cat > tmp/keys <<-EOF
-1 $(tr -c -d 'a-zA-Z0-9' < /dev/urandom 2> /dev/null | head -c 24)
-2 ASCII:$(tr -c -d 'a-zA-Z0-9' < /dev/urandom 2> /dev/null | head -c 24)
-3 MD5 ASCII:$(tr -c -d 'a-zA-Z' < /dev/urandom 2> /dev/null | head -c 24)
-4 MD5 HEX:$(tr -c -d '0-9A-F' < /dev/urandom 2> /dev/null | head -c 32)
+server_conf="keyfile tmp/server.keys"
+client_conf="keyfile tmp/client.keys"
+
+cat > tmp/server.keys <<-EOF
+1 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E
+2 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E
+3 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E
+4 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E
+EOF
+
+cat > tmp/client.keys <<-EOF
+1 k]<j.Jtw^Oo;z5E>n\_0-x=)yP\f<)Z^
+2 ASCII:k]<j.Jtw^Oo;z5E>n\_0-x=)yP\f<)Z^
+3 MD5 ASCII:k]<j.Jtw^Oo;z5E>n\_0-x=)yP\f<)Z^
+4 MD5 HEX:6B5D3C6A2E4A74775E4F6F3B7A35453E6E5C5F302D783D2979505C663C295A5E
EOF
-for key in 1 2 3 4; do
+keys=4
+
+if grep -q 'FEAT_SECHASH 1' ../../config.h; then
+ hashes="MD5 SHA1 SHA256 SHA384 SHA512"
+else
+ hashes="MD5"
+fi
+
+for hash in $hashes; do
+ keys=$[$keys + 1]
+ key=$(echo $keys $hash HEX:$(tr -c -d '0-9A-F' < /dev/urandom 2> /dev/null | \
+ head -c $[$RANDOM % 64 * 2 + 2]))
+ echo "$key" >> tmp/server.keys
+ echo "$key" >> tmp/client.keys
+done
+
+for key in $(seq $keys); do
client_server_options="key $key"
run_test || test_fail
check_chronyd_exit || test_fail
@@ -31,7 +54,7 @@ check_chronyd_exit || test_fail
check_sync && test_fail
check_packet_interval || test_fail
-server_conf="keyfile tmp/keys"
+server_conf="keyfile tmp/server.keys"
client_conf=""
run_test || test_fail
@@ -40,10 +63,10 @@ check_chronyd_exit || test_fail
check_sync && test_fail
check_packet_interval || test_fail
-client_conf="keyfile tmp/keys"
+client_conf="keyfile tmp/client.keys"
clients=2
peers=2
-max_sync_time=300
+max_sync_time=500
base_delay="$default_base_delay (* -1 (equal 0.1 from 3) (equal 0.1 to 1))"
client_lpeer_options="key 1"
client_rpeer_options="key 1"
diff --git a/test/simulation/110-chronyc b/test/simulation/110-chronyc
index 29ade1c..34ee283 100755
--- a/test/simulation/110-chronyc
+++ b/test/simulation/110-chronyc
@@ -13,7 +13,7 @@ check_chronyd_exit || test_fail
check_chronyc_output "^Reference ID : 192\.168\.123\.1 \(192\.168\.123\.1\)
Stratum : 2
-Ref time \(UTC\) : Fri Jan 1 00:1.:.. 2010
+Ref time \(UTC\) : Fri Jan 01 00:1.:.. 2010
System time : 0\.0000..... seconds (slow|fast) of NTP time
Last offset : [+-]0\.000...... seconds
RMS offset : 0\.000...... seconds
@@ -25,7 +25,7 @@ Root dispersion : 0\.000... seconds
Update interval : [0-9]+\.. seconds
Leap status : Normal
210 Number of sources = 1
-MS Name/IP address Stratum Poll Reach LastRx Last sample
+MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
\^\* 192\.168\.123\.1 1 [67] 377 [0-9]+ [0-9 +-]+[un]s\[[0-9 +-]+[un]s\] \+/-[ 0-9]+[un]s
210 Number of sources = 1
diff --git a/test/simulation/115-cmdmontime b/test/simulation/115-cmdmontime
index 6eb495a..2806a1f 100755
--- a/test/simulation/115-cmdmontime
+++ b/test/simulation/115-cmdmontime
@@ -10,11 +10,11 @@ grep -q 'HAVE_LONG_TIME_T 1' ../../config.h || test_skip
limit=2
client_server_options="noselect"
client_conf="local stratum 1"
-chronyc_start="0.5"
+chronyc_start="1.5"
chronyc_conf="tracking"
for year in `seq 1850 100 2300`; do
- date="Jan 1 00:00:00 $year"
+ date="Jan 01 00:00:00 $year"
export CLKNETSIM_START_DATE=$(date -d "$date UTC" +'%s')
run_test || test_fail
check_chronyd_exit || test_fail
diff --git a/test/simulation/121-orphan b/test/simulation/121-orphan
new file mode 100755
index 0000000..ed92153
--- /dev/null
+++ b/test/simulation/121-orphan
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+. ./test.common
+
+test_start "orphan option"
+
+server_strata=3
+server_conf="local stratum 5 orphan
+server 192.168.123.1
+server 192.168.123.2
+server 192.168.123.3"
+max_sync_time=500
+chronyc_start=300
+chronyc_conf="tracking"
+time_rms_limit=5e-4
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_source_selection || test_fail
+check_sync || test_fail
+check_chronyc_output "^.*Stratum *: 7.*$" || test_fail
+
+test_pass
diff --git a/test/unit/Makefile.in b/test/unit/Makefile.in
index 5fd925c..554663b 100644
--- a/test/unit/Makefile.in
+++ b/test/unit/Makefile.in
@@ -33,6 +33,9 @@ clean:
rm -f *.o $(TESTS)
rm -rf .deps
+distclean: clean
+ rm -f Makefile
+
.deps:
@mkdir .deps
diff --git a/util.c b/util.c
index 6967a9e..9085ff6 100644
--- a/util.c
+++ b/util.c
@@ -362,6 +362,7 @@ UTI_IPToRefid(IPAddr *ip)
uint32_t
UTI_IPToHash(IPAddr *ip)
{
+ static uint32_t seed = 0;
unsigned char *addr;
unsigned int i, len;
uint32_t hash;
@@ -379,10 +380,15 @@ UTI_IPToHash(IPAddr *ip)
return 0;
}
- for (i = 0, hash = 0; i < len; i++)
+ /* Include a random seed in the hash to randomize collisions
+ and order of addresses in hash tables */
+ while (!seed)
+ UTI_GetRandomBytes(&seed, sizeof (seed));
+
+ for (i = 0, hash = seed; i < len; i++)
hash = 71 * hash + addr[i];
- return hash;
+ return hash + seed;
}
/* ================================================== */
@@ -801,9 +807,10 @@ UTI_FloatNetworkToHost(Float f)
x = ntohl(f.f);
- exp = (x >> FLOAT_COEF_BITS) - FLOAT_COEF_BITS;
+ exp = x >> FLOAT_COEF_BITS;
if (exp >= 1 << (FLOAT_EXP_BITS - 1))
exp -= 1 << FLOAT_EXP_BITS;
+ exp -= FLOAT_COEF_BITS;
coef = x % (1U << FLOAT_COEF_BITS);
if (coef >= 1 << (FLOAT_COEF_BITS - 1))
diff --git a/version.txt b/version.txt
index bb576db..6b4950e 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-2.3
+2.4