1 #! /bin/sh 2 # 3 # In daemon mode htpdate writes the systematic drift of the clock to syslog. 4 # With this script you can convert the PPM drift values into adjtimex 5 # parameters. Only use this script when you know what you are doing. 6 # 7 # Consult adjtimex man page for more information. 8 9 if [ ! $1 ]; then 10 echo "Usage: $0 <PPM> [current TICK] [current FREQ]" 11 echo "By default TICK=10000 and FREQ=0" 12 echo 13 exit 1 14 fi 15 16 PPM=$1 17 TICK=10000 18 FREQ=0 19 20 if [ $2 ]; then 21 TICK=$2 22 fi 23 24 if [ $3 ]; then 25 FREQ=$3 26 fi 27 28 FREQTOT=`echo "$PPM * 65536 + $TICK * 6553600 + $FREQ" | bc` 29 30 TICK=`echo "$FREQTOT / 6553600" | bc` 31 FREQ=`echo "$FREQTOT % 6553600" | bc | awk -F. '{print $1}'` 32 33 echo "TICK=$TICK" 34 echo "FREQ=$FREQ" 35 echo "Suggested command: adjtimex -tick $TICK -frequency $FREQ"