TIMESLAVE(1M) TIMESLAVE(1M) NAME timeslave - 'slave' local clock to a better one SYNOPSIS timeslave [ options ] -H netmaster timeslave [ options ] -C /dev/ttydXX where options can be any of: [-mdBQY] [-w icmp-wait] [-W time-wait] [-t min-trials] [-T max-trials] [-r rate] [-p port] [-D max-drift] [-i init-drift] [-y year] [-P param-file] [-c clock-type] DESCRIPTION Timeslave matches the clock in the local machine to a better clock. It does this by speeding up or slowing down the local clock, or if the local clock is particularly wrong, by changing the date. When the date is changed, because the difference is too great to correct smoothly, timeslave logs the event in the system log. Timeslave understands several options: -H netmaster specifies the hostname or Internet address of another machine that has a better clock or that has, in turn, slaved its clock to a better one. Either a host must be specified with -H or a device must be specified with -C, but not both. -C /dev/ttyXX specifies the filename of a tty port, such as /dev/ttyd2, with a Precision Time Standards or Traconex/Multisonics WWV receiver. -P param-file specifies a file in which to save a computed value of the timetrim parameter. The active value in the operating system is set to the value found in the file when the daemon started. A good choice for the file name is /var/adm/timetrim. -c clock-type specifies the kind of WWV or GPS receiver/clock connected to the device specified with -C. Supported types of clocks are: TRC_WWV Traconix PST_WWV or Precision Standard Time WWV receiver TT600 TrueTime model 600 GPS receiver The default clock type is PST_WWV. It is usually not necessary to use the following options to change the default values compiled in timeslave: -m causes timeslave to measure the difference between the local and remote clock (or WWV receiver), but to not change the local clock. -d increases the 'debugging level,' causing more messages to appear in the system log. Specifying this option several times increases the amount of debugging information. The signals SIGUSR1 and SIGUSR2 can be used to increase and decrease, respectively, the current amount of debugging information. -B disables the normal 'backgrounding' of the daemon. -q disables error messages caused by network links that make the netmaster intermittently unreachable. This can be useful for "demand dialing" SLIP links (see slip(1M)). -w icmp-wait is the number of seconds before an ICMP timestamp packet is assumed to have been lost in the network. The default is 1 second. -W time-wait is the number of seconds before the remote machine is assumed to be not answering time service requests. The first time the remote machine fails to answer a time service request is logged in the system log. Additional failures are also logged if debugging is requested. The default is 4 seconds. -t min-trials specifies the minimum number of ICMP packets to use to determine the time difference. The default value is calculated as follows: min- trials=4 if the default value of max-trials is used, otherwise min- trials=max-trials/4. -T max-trials specifies the maximum number of ICMP packets to use to determine the time difference. If the remote machine does not respond to this many requests, it is assumed to be temporarily dead. The default value is calculated as follows: max-trials=16 if the default value of min-trials is used, otherwise max-trials=min-trials*4. -r rate specifies the approximate number of seconds between measurements. The separation between measurements must be at least 5 seconds. Shorter periods do not allow enough time to correct the local clock. The default is 3 minutes and 30 seconds. A period of 90 seconds is always used when first starting to start the filters. Very long periods do not allow provide enough data to avoid over correction. The time between one measurement and the next is changed slightly each time to avoid systematic errors caused by other activity in the machines or the network in general. For example, cron starts a request in the first few seconds of a minute. -p port is the port number on which the other machine provides Internet time service, as describe in RFC-868. The default port comes from the "time" udp service defined in /etc/services. -D max-drift specifies the maximum rate at which the local and remote clocks can be expected to drift, in nanoseconds per second. This is used to discard bad measurements. Its default value is 1% or 10,000,000 nanoseconds per second. -i init-drift specifies an initial value of the drift of the local clock in nanoseconds per second. This value can be used to make timeslave better behaved when it is first started. The default is 0 drift. -y year specifies a year, overriding the value obtained from the WWV receiver or the remote system. This parameter is handy when -C is used and the switch settings to change the year in the WWV receiver are forgotten, or when -H is used and the netmaster is confused about the year. The year is automatically adjusted at midnight, January 1. -Y specifies that the year should be consistent with the modification date of the file specified with -P. Timeslave consumes less network bandwidth, fewer CPU cycles and less memory on both the local and remote machines than timed(1M). Timed is appropriate for a group of peers which average their equivalently accurate clocks to find a better estimate of the correct time. Because the master of the network time is elected by the timed participants, more correct time can be maintained despite the failure of individual systems. A small, homogeneous group of machines should use timed, rather than timeslave. In a large network, one should use a small group of trusted, well-administered machines running timed with the -F or -G option to exclude other machines. The excluded machines should run timed with only the -M flag. One of the trusted machines should, if possible, be slaved with timeslave to a WWV receiver, or some remote machine with a very accurate clock. This machine should be lightly loaded, and should use the -F option with timed to make itself the most trusted time keeper in the local network. This scheme, a ``king'' with a circle of trusted substitutes surrounded by a larger number of machines should be replicated on each subnetwork in an installation, building a hierarchy of domains. The local king can use timeslave to synchronize its clock to very remote machines over low-performance, wide-area networks such as the DARPA Internet. A subnetwork consisting of two or more sub-subnetworks, such as a group of ethernets, can be synchronized in a similar fashion. The king of the subnetwork would be synchronized with timeslave to a remote network or a WWV receiver (see below). The circle of trusted substitutes would be the gateways to the other sub-subnetworks. Timeslave operates in one of two modes. In the first, it matches the clock in the local machine to the clock in some other machine. It sends UDP datagrams to the 'time' service on the other machine to determine the current day. The time service on machines using 4.3BSD-style networking is provided by the inetd(1M) daemon. This allows timeslave to determine the correct day. Timeslave then uses ICMP timestamp packets to measure difference between the local and remote clocks in milliseconds. It assumes that the round trip delay for packets to and from the remote machine is symmetric. This is usually a valid assumption. However, large network data transfers can make transmission delays tens of thousands of times larger or smaller than reception delays. Therefore, timeslave elaborately averages its measurements. In addition, it lowers its scheduling priority to minimize the effects of other programs on the local machine. The second mode in which timeslave can operate is with a Precision Time Standards or Traconex/Multisonics WWV receiver. In this case, it still must average its measurements to compensate for variable delays due to the operating system. When using a clock, it is best to minimize any latencies in the serial line connected to the clock, by adjusting the relevant parameters for the driver. See cdsio(1M) and sduart(1M). The switches in the receiver should be configured to use "eight bits without parity," a "baud rate" of 9600, and daylight-saving time disabled. Timeslave logs accumulated corrections in the system log (see syslogd(1M) to ease adjusting the local clock. The clock can be adjusted by changing the timetrim parameter using systune(1M). This parameter is used by the operating system to compensate for variations among machines. It can be used to improve the accuracy of the local clock. Timeslave immediately replaces the kernel value of the timetrim parameter with the contents of the file specified with the -P option, and after measuring for several hours, chooses a better value. The value is continually refined. Besides logging in the system the value, timeslave periodically writes the value to the file specified with -P. An error message is displayed when the daemon is first started if the file contains nonsense. However, a corrected value will be placed in the file during its normal updates. Messages printed by the kernel on the system console occur with interrupts disabled. This means that the clock stops while they are printing. A machine with many disk or network hardware problems and consequent messages cannot keep good time by itself. Each message typically causes the clock to lose a dozen milliseconds. A time daemon can correct the result, but will compute a bogus timetrim value. WARNING Temporal chaos results if two or more time daemons, whether timed, timeslave, or NTP, try to adjust the same clock. FILES /var/adm/SYSLOG system log /etc/init.d/network start-up script /etc/config/timeslave.options optional configuration flags /dev/ttydXX tty port attached to clock. SEE ALSO chkconfig(1M), inetd(1M), syslog(1M), timed(1M), timedc(1M), icmp(7P), systune(1M) BUGS The filtering is not good enough when the local clock is worse than one part in 10**4 or the network is overloaded. Timeslave does not communicate its confidence in the time to a timed running on the local machine. Page 5