<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<!-- conversion to man: 
  xsltproc  /usr/apps/docbook/xsl/1.67.2/manpages/docbook.xsl clockdiff.8.dbk
-->
<refentry id="clockdiff">
    <refentryinfo>
        <productname>Linux</productname>
        <title>System Administration</title>
        <date>27 September 2002</date>
    </refentryinfo>
	<refmeta>
		<refentrytitle>clockdiff</refentrytitle>
		<manvolnum>8</manvolnum>
	</refmeta>
	<refnamediv>
		<refname>clockdiff</refname>
		<refpurpose>measure clock difference between hosts</refpurpose>
	</refnamediv>
	<refsynopsisdiv>
		<cmdsynopsis>
			<command>clockdiff</command>
			<arg>
				<option>-o</option>
			</arg>
			<arg>
				<option>-o1</option>
			</arg>
			<arg choice="plain">
				<replaceable>destination</replaceable>
			</arg>
		</cmdsynopsis>
	</refsynopsisdiv>
	
	<refsection>
		
		<title>DESCRIPTION</title>
		
<para><command>clockdiff</command> measures clock difference between us
and <replaceable>destination</replaceable> with 1&nbsp;msec resolution using
<link linkend="clockdiff.icmp-timestamp">ICMP TIMESTAMP</link> packets or,
optionally,  <link linkend="clockdiff.ip-timestamp">IP TIMESTAMP</link> option 
added to <link linkend="clockdiff.icmp-echo">ICMP ECHO</link>.</para>
	</refsection>
	
	<refsection>
		
		<title>OPTIONS</title>
		
		<variablelist>
			<varlistentry>
				<term>
					<option>-o</option>
				</term>
				<listitem>
<para>Use IP TIMESTAMP with ICMP ECHO instead of ICMP
TIMESTAMP messages. It is useful with some destinations,
which do not support ICMP TIMESTAMP (e.g. Solaris&nbsp;&lt;&nbsp;2.4).</para>
				</listitem>
			</varlistentry>
			<varlistentry>
				<term>
					<option>-o1</option>
				</term>
				<listitem>
<para> Slightly different form of <option>-o</option>, namely it
uses three-term IP TIMESTAMP with prespecified hop
addresses instead of four term one. What flavor
works better depends on target host.
Particularly, <option>-o</option> is better for Linux.</para>
				</listitem>
			</varlistentry>
		</variablelist>
	</refsection>
	
	<refsection>
		
		<title>WARNINGS</title>
		
		<itemizedlist>
			<listitem>
<para> Some nodes (Cisco) use non-standard timestamps, which is
allowed by RFC, but makes timestamps mostly useless.</para>
			</listitem>
			<listitem>
<para> Some nodes generate messed timestamps
(Solaris&nbsp;&gt;&nbsp;2.4), when run <command>xntpd</command>. Seems, its
IP stack uses a corrupted clock source, which is
synchronized to time-of-day clock periodically and jumps
randomly making timestamps mostly useless. Good news is
that you can use NTP in this case, which is even better.</para>
			</listitem>
			<listitem>
<para><command>clockdiff</command> shows difference in time modulo 
24 days.</para>
			</listitem>
		</itemizedlist>
	</refsection>
	
	<refsection>
		
		<title>SEE ALSO</title>
		
		<para>
			<citerefentry>
				<refentrytitle>ping</refentrytitle>
				<manvolnum>8</manvolnum>
			</citerefentry>, <citerefentry>
				<refentrytitle>arping</refentrytitle>
				<manvolnum>8</manvolnum>
			</citerefentry>, <citerefentry>
				<refentrytitle>tracepath</refentrytitle>
				<manvolnum>8</manvolnum>
			</citerefentry>.</para>
	</refsection>
	
	<refsection>
		
		<title>REFERENCES</title>
		
		<itemizedlist>
			<listitem>
				<para>ICMP ECHO, <ulink id="clockdiff.icmp-echo"
					url="ftp://ftp.isi.edu/in-notes/rfc792.txt"
					>RFC0792, page 14</ulink>.</para>
			</listitem>
			<listitem>
				<para>ICMP TIMESTAMP, <ulink id="clockdiff.icmp-timestamp"
					url="ftp://ftp.isi.edu/in-notes/rfc792.txt"
					>RFC0792, page 16</ulink>.</para>
			</listitem>
			<listitem>
				<para>IP TIMESTAMP option, <ulink id="clockdiff.ip-timestamp"
					url="ftp://ftp.isi.edu/in-notes/rfc791.txt"
					>RFC0791, 3.1, page 16</ulink>.</para>
			</listitem>
		</itemizedlist>
	</refsection>
	
	<refsection>
		
		<title>AUTHOR</title>
		
<para><command>clockdiff</command> was compiled by <address>
<firstname>Alexey</firstname> <surname>Kuznetsov</surname><email
>kuznet@ms2.inr.ac.ru</email></address>. It was based on
code borrowed from BSD <command>timed</command> daemon.</para>
	</refsection>
	
	<refsection>
		
		<title>SECURITY</title>
		
<para><command>clockdiff</command> requires <constant
>CAP_NET_RAWIO</constant> capability to be executed. It is safe 
to be used as set-uid root.</para>
	</refsection>
	
	<refsection>
		
		<title>AVAILABILITY</title>
		
<para><command>clockdiff</command> is part 
of <application>iputils</application> package and the
latest versions are available in source form for anonymous
via <ulink
url="ftp://ftp.inr.ac.ru/ip-routing/iputils-current.tar.gz"/>.</para>
	</refsection>
</refentry>

