rate.awk

来自「实现linux系统和网络时钟服务器的时间同步,从而可以得到准确的时间.」· AWK 代码 · 共 19 行

AWK
19
字号
(FNR==1){ day_off=$1;        t1=$2; o1=$5; f1=$7}        { t2=($1-day_off)*86400+$2; o2=$5; f2=$7; if (f2!=f1) fwarn=1}END{  print "delta-t",t2-t1,"seconds"  print "delta-o",o2-o1,"useconds"  if (fwarn) print " *** frequency changed in the middle - don't use ***"  slope=(o2-o1)/(t2-t1)  print "slope",slope,"ppm"  print "old frequency",f1,"(",f1/65536,"ppm)"  f3=f1+int(slope*65536);  print "new frequency",f3,"(",f3/65536,"ppm)"}# the final value is what you should push into the adjtimex(2) field.# i.e., if the last line shows# new frequency -1318109 ( -20.1127 ppm)# you put -1318109 into the -f switch of adjtimex (e.g., adjtimex -f -1318109)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?