aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/xntpd/hints/solaris
blob: 038d65f996345e42560841fd9f9c7c5bebf54b2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  A quick summary of how to compile under Solaris:

  If you are running Solaris 2.0, you should upgrade to a later version of 
Solaris immediately.
  If you are running Solaris 2.1, you should use Config.solaris2.1
  If you are running Solaris 2.2 or later, you should use Config.solaris2.2

  Solaris 2.1 contains fairly traditional clock code, with tick and tickadj.
Solaris 2.2 and later contains completely re-written clock code to provide 
high resolution microsecond timers. A benefit of the re-written clock code 
is that adjtime does not round off its adjustments, so xntp does not have to 
compensate for this rounding. On Solaris 2.2 and later we #define
ADJTIME_IS_ACCURATE, and do not look for the tickadj kernel variable.

  If you are running both Solaris 2.1 and 2.2 on your net, you will need to 
maintain two sets of xntp binaries. The Config.solaris2.2 file will compile
on Solaris 2.1, but the resulting binaries will not work correctly.

ADDITIONAL NOTES FOR SOLARIS 2.1
(by William L. Jones jones@chpc.utexas.edu)

Since settimeofday under Solaris 2.1 only sets the seconds part of timeval
care must be used in starting xntpd.  I suggest the following start
up script:

 tickadj -s -a 1000
 ntpdate -v server1 server2
 sleep 20
 ntpdate -v server1 server2
 sleep 20
 tickadj -a 200
 xntpd

The first tickadj turns of the time of day clock and sets the tick adjust
value to 1 ms.  This will insure that an adjtime value of at most 2
seconds will complete in 20 seconds.

The first ntpdate will set the time to within two seconds 
using settimeofday or it will adjust time using adjtime.

The first sleep insures the adjtime has completed for the first ntpdate.

The second ntpdate will use adjtime to set the time of day since the
clock should be within 2 seconds of the correct time.

The second tickadj set the tick adjust system value to 5 us.

The second sleeps insure that adjtime will complete before starting 
the next xntpd.

I tried running with a tickadj of 5 us with out much success.
200 us seems to work well.  


ADDITIONAL NOTES FOR SOLARIS 2.2 AND LATER:
  You still need to turn off dosynctodr for XNTP to be able to keep accurate 
time. You can either do this in the /etc/system file (consulted at boot to set
various kernel variables) by putting in the following line:
set dosynctodr=0
or you can use the tickadj program to force the variable to 0 in the running
kernel. Fiddling with a running kernel is almost never a good idea, I'd 
recommend using /etc/system.
  I would recommend starting xntp from the following script, placed in 
/etc/rc2.d and named S99xntpd

#!/bin/sh

if [ $1 = "start" ]; then
        if [ -x /usr/local/bin/xntpd ]; then
                echo "Starting NTP daemon, takes about 1 minute... "
		# The following line is unnecessary if you turn off 
		# dosynctodr in /etc/system.
                /usr/local/bin/tickadj -s  
                /usr/local/bin/ntpdate -v server1 server2
                sleep 5
                /usr/local/bin/xntpd
        fi
else
        if [ $1 = "stop" ]; then
                pid=`/usr/bin/ps -e | /usr/bin/grep xntpd | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`   
                if [ "${pid}" != "" ]; then
                        echo "Stopping Network Time Protocol daemon "
                        /usr/bin/kill ${pid}
                fi     
        fi
fi

Denny Gentry denny@eng.sun.com