Current Path : /usr/src/contrib/ntp/scripts/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/src/contrib/ntp/scripts/calc_tickadj.in |
#! @PATH_PERL@ # # drift of 104.8576 -> +1 tick. Base of 10000 ticks. # # 970306 HMS Deal with nanoseconds. Fix sign of adjustments. $df="/etc/ntp.drift"; # Assumes a 100Hz box with "tick" of 10000 # Someday, we might call "tickadj" for better values... $base=10000; # tick: 1,000,000 / HZ $cvt=104.8576; # 2 ** 20 / $base $v1=0.; $v2=""; if (open(DF, $df)) { if ($_=<DF>) { ($v1, $v2) = split; } while ($v1 < 0) { $v1 += $cvt; $base--; } while ($v1 > $cvt) { $v1 -= $cvt; $base++; } } printf("%.3f (drift)\n", $v1); printf("%d usec; %d nsec\n", $base, ($base + ($v1/$cvt)) * 1000);