timed.8   [plain text]


.\" Copyright (c) 1980, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     @(#)timed.8	8.1 (Berkeley) 6/6/93
.\"
.Dd June 6, 1993
.Dt TIMED 8
.Os BSD 4.3
.Sh NAME
.Nm timed
.Nd time server daemon
.Sh SYNOPSIS
.Nm timed
.Op Fl M
.Op Fl t
.Op Fl d
.Op Fl i Ar network
.Op Fl n Ar network
.Op Fl F Ar host1 host2 ...
.Sh DESCRIPTION
This
is a time server daemon and is normally invoked
at boot time from the
.Xr rc 8
file.  
It synchronizes the host's time with the time of other
machines in a local area network running 
.Nm timed 8 .
These time servers will slow down the clocks of some machines
and speed up the clocks of others to bring them to the average network time.
The average network time is computed from measurements of clock differences
using the
.Tn ICMP
timestamp request message.
.Pp
The service provided by
.Nm timed
is based  on a master-slave
scheme.
When
.Nm timed 8
is started on a machine, it asks the master for the network time
and sets the host's clock to that time.
After that, it accepts synchronization messages periodically sent by
the master and calls 
.Xr adjtime 2
to perform the needed corrections on the host's clock.
.Pp
It also communicates with
.Xr date 1
in order to set the date globally,
and with 
.Xr timedc 8 ,
a timed control program.
If the machine running the master crashes, then the slaves will elect
a new master from among slaves running with the 
.Fl M
flag.
A
.Nm timed
running without the
.Fl M
or
.Fl F
flags will remain a slave.
The 
.Fl t
flag enables
.Nm timed
to trace the messages it receives in the
file
.Pa /var/log/timed.log .
Tracing can be turned on or off by the program
.Xr timedc 8 .
The
.Fl d
flag is for debugging the daemon.
It causes the program to not put itself into the background.
Normally
.Nm timed
checks for a master time server on each network to which
it is connected, except as modified by the options described below.
It will request synchronization service from the first master server
located.
If permitted by the
.Fl M
flag, it will provide synchronization service on any attached networks
on which no current master server was detected.
Such a server propagates the time computed by the top-level master.
The 
.Fl n
flag, followed by the name of a network which the host is connected to
(see
.Xr networks 5 ) ,
overrides the default choice of the
network addresses made by the program.
Each time the
.Fl n
flag appears, that network name is added to a list of valid networks.
All other networks are ignored.
The 
.Fl i
flag, followed by the name of a network to which the host is connected
(see
.Xr networks 5 ) ,
overrides the default choice of the network addresses made by the program.
Each time the
.Fl i
flag appears, that network name is added to a list of networks to ignore.
All other networks are used by the time daemon.
The
.Fl n
and 
.Fl i
flags are meaningless if used together.
.Pp
.Nm Timed
checks for a master time server on each network to which
it is connected, except as modified by the
.Fl n
and
.Fl i
options described above.
If it finds masters on more than one network, it chooses one network
on which to be a "slave," and then periodically checks the other
networks to see if the masters there have disappeared.
.Pp
One way to synchronize a group of machines is to use an NTP daemon to 
synchronize the clock of one machine to a distant standard or a radio
receiver and 
.Fl F Ar hostname
to tell its timed daemon to trust only itself.
.Pp
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.
.Pp
Messages in the system log about machines that failed to respond
usually indicate machines that crashed or were turned off.
Complaints about machines that failed to respond to initial time
settings are often associated with "multi-homed" machines
that looked for time masters on more than one network and eventually
chose to become a slave on the other network.
.Sh WARNING
If two or more time daemons, whether 
.Nm timed ,
.Xr NTP ,
try to adjust the same clock, temporal chaos will result.
If both 
.Nm
and another time daemon are run on the same machine,
ensure that the 
.Fl F
flag is used, so that 
.Nm timed
never attempts to adjust the local clock.
.Pp 
The protocol is based on UDP/IP broadcasts.  All machines within
the range of a broadcast that are using the TSP protocol must cooperate.
There cannot be more than a single administrative domain using the
.Fl F
flag among all machines reached by a broadcast packet.
Failure to follow this rule is usually indicated by complaints concerning
"untrusted" machines in the system log.
.Sh FILES
.Bl -tag -width /var/log/timed.masterlog -compact
.It Pa /var/log/timed.log
tracing file for timed
.It Pa /var/log/timed.masterlog
log file for master timed 
.El
.Sh SEE ALSO
.Xr date 1 ,
.Xr adjtime 2 ,
.Xr gettimeofday 2 ,
.Xr icmp 4 ,
.Xr timedc 8 ,
.Rs
.%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD"
.%A R. Gusella
.%A S. Zatti
.Re
.Sh HISTORY
The
.Nm
daemon appeared in
.Bx 4.3 .