1.\" $NetBSD: timed.8,v 1.9 2001/04/05 11:53:11 wiz Exp $ 2.\" 3.\" Copyright (c) 1980, 1991 Regents of the University of California. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by the University of 17.\" California, Berkeley and its contributors. 18.\" 4. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)timed.8 8.1 (Berkeley) 6/6/93 35.\" 36.Dd May 11, 1993 37.Dt TIMED 8 38.Os 39.Sh NAME 40.Nm timed 41.Nd time server daemon 42.Sh SYNOPSIS 43.Nm 44.Op Fl M 45.Op Fl t 46.Op Fl d 47.Op Fl i Ar network 48.Op Fl n Ar network 49.Op Fl F Ar host1 host2 ... 50.Sh DESCRIPTION 51This 52is a time server daemon and is normally invoked 53at boot time from the 54.Xr rc 8 55file. 56It synchronizes the host's time with the time of other 57machines in a local area network running 58.Nm "" . 59These time servers will slow down the clocks of some machines 60and speed up the clocks of others to bring them to the average network time. 61The average network time is computed from measurements of clock differences 62using the 63.Tn ICMP 64timestamp request message. 65.Pp 66The service provided by 67.Nm 68is based on a master-slave 69scheme. 70When 71.Nm 72is started on a machine, it asks the master for the network time 73and sets the host's clock to that time. 74After that, it accepts synchronization messages periodically sent by 75the master and calls 76.Xr adjtime 2 77to perform the needed corrections on the host's clock. 78.Pp 79It also communicates with 80.Xr date 1 81in order to set the date globally, 82and with 83.Xr timedc 8 , 84a timed control program. 85If the machine running the master crashes, then the slaves will elect 86a new master from among slaves running with the 87.Fl M 88flag. 89A 90.Nm 91running without the 92.Fl M 93or 94.Fl F 95flags will remain a slave. 96The 97.Fl t 98flag enables 99.Nm 100to trace the messages it receives in the 101file 102.Pa /var/log/timed.log . 103Tracing can be turned on or off by the program 104.Xr timedc 8 . 105The 106.Fl d 107flag is for debugging the daemon. 108It causes the program to not put itself into the background. 109Normally 110.Nm 111checks for a master time server on each network to which 112it is connected, except as modified by the options described below. 113It will request synchronization service from the first master server 114located. 115If permitted by the 116.Fl M 117flag, it will provide synchronization service on any attached networks 118on which no current master server was detected. 119Such a server propagates the time computed by the top-level master. 120The 121.Fl n 122flag, followed by the name of a network which the host is connected to 123(see 124.Xr networks 5 ) , 125overrides the default choice of the 126network addresses made by the program. 127Each time the 128.Fl n 129flag appears, that network name is added to a list of valid networks. 130All other networks are ignored. 131The 132.Fl i 133flag, followed by the name of a network to which the host is connected 134(see 135.Xr networks 5 ) , 136overrides the default choice of the network addresses made by the program. 137Each time the 138.Fl i 139flag appears, that network name is added to a list of networks to ignore. 140All other networks are used by the time daemon. 141The 142.Fl n 143and 144.Fl i 145flags are meaningless if used together. 146.Pp 147.Nm 148checks for a master time server on each network to which 149it is connected, except as modified by the 150.Fl n 151and 152.Fl i 153options described above. 154If it finds masters on more than one network, it chooses one network 155on which to be a "slave," and then periodically checks the other 156networks to see if the masters there have disappeared. 157.Pp 158One way to synchronize a group of machines is to use an NTP daemon to 159synchronize the clock of one machine to a distant standard or a radio 160receiver and 161.Fl F Ar hostname 162to tell its timed daemon to trust only itself. 163.Pp 164Messages printed by the kernel on the system console occur with 165interrupts disabled. 166This means that the clock stops while they are printing. 167A machine with many disk or network hardware problems and consequent 168messages cannot keep good time by itself. Each message typically causes 169the clock to lose a dozen milliseconds. A time daemon can 170correct the result. 171.Pp 172Messages in the system log about machines that failed to respond 173usually indicate machines that crashed or were turned off. 174Complaints about machines that failed to respond to initial time 175settings are often associated with 176.Dq multi-homed 177machines that looked for time masters on more than one network and eventually 178chose to become a slave on the other network. 179.Sh WARNINGS 180If two or more time daemons, whether 181.Nm "" , 182.Xr ntpd 8 , 183try to adjust the same clock, temporal chaos will result. 184If both 185.Nm 186and another time daemon are run on the same machine, 187ensure that the 188.Fl F 189flag is used, so that 190.Nm 191never attempts to adjust the local clock. 192.Pp 193The protocol is based on UDP/IP broadcasts. All machines within 194the range of a broadcast that are using the TSP protocol must cooperate. 195There cannot be more than a single administrative domain using the 196.Fl F 197flag among all machines reached by a broadcast packet. 198Failure to follow this rule is usually indicated by complaints concerning 199.Dq untrusted 200machines in the system log. 201.Sh FILES 202.Bl -tag -width /var/log/timed.masterlog -compact 203.It Pa /var/log/timed.log 204tracing file for timed 205.It Pa /var/log/timed.masterlog 206log file for master timed 207.El 208.Sh SEE ALSO 209.Xr date 1 , 210.Xr adjtime 2 , 211.Xr gettimeofday 2 , 212.Xr icmp 4 , 213.Xr timedc 8 214.Rs 215.%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD" 216.%A R. Gusella 217.%A S. Zatti 218.Re 219.Sh HISTORY 220The 221.Nm 222daemon appeared in 223.Bx 4.3 . 224