博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
adjtimex修改tick值用法举例
阅读量:6612 次
发布时间:2019-06-24

本文共 4425 字,大约阅读时间需要 14 分钟。

测试

用户态下内核时钟计数间隔,默认都是100HZ。因此单个tick代表了10^4 us。

可以设置每个tick代表的时钟长度,因此把tick增加1(即增加为10001us)的影响是每天时间快8.64s

24360010010001/10^6-243600=8.64s。

意思是:

对于正常的机器,+1 tick,一天后,ntpq -np会显示,-8640

推理:

对于异常的机器:

如果机器的时钟电路很快,一天下来,总是比正常时间快,ntpq -np总是显示负值,比如,机器A每天都会以-8640速度增加误差,- 8640 ms / ( 24h * 60 min ) = -6ms/1min,那么,应该给其tick减1

如果机器的时钟电路很慢,一天下来,总是比正常时间慢,ntpq -np总是显示正值,比如,机器B每天都会以+8640速度增加误差,+ 8640 ms / ( 24h * 60 min ) = +6ms/1min,那么,应该给其tick加1

我现在把tick值修改为10050,相当于增加50;前面我们有结论是为了让时间快一点, tick值加1,那么加50,相当于,每分钟时间快300ms,和实际测量的317毫秒基本相差不大

[root@dnstest07.tbc /home/ahao.mah]#/home/tops/bin/adjtimex -t 10050
[root@dnstest07.tbc /home/ahao.mah]#/home/tops/bin/adjtimex -cWARNING: CMOS time is 30.03 min behind system clock                                      --- current ---   -- suggested --cmos time     system-cmos  error_ppm   tick      freq    tick      freq1487621068   59055.3771601487621078   59055.593597    21643.8  10050  203542911487621088   59055.830139    23654.2  10050  20354291    9816   36951291487621097   59056.030826    20068.7  10050  20354291    9852   27467791487621107   59056.262891    23206.5  10050  20354291    9821    2693161487621117   59056.479460    21657.0  10050  20354291    9836   35137541487621127   59056.695908    21644.8  10050  20354291    9836   43121911487621137   59056.912304    21639.6  10050  20354291    9836   4654379

观察一段时间:: 发现每分钟以317ms的速度偏离;

[root@dnstest07.tbc /home/ahao.mah]#crontab -l* * * * * (/usr/sbin/ntpdate -q 10.210.208.8) >> /var/log/ntpdate.lo
[root@dnstest07.tbc /home/ahao.mah]#cat /var/log/ntpdate.logserver 10.210.208.8, stratum 4, offset 0.012350, delay 0.0271021 Feb 17:16:02 ntpdate[84349]: adjust time server 10.210.208.8 offset 0.012350 secserver 10.210.208.8, stratum 4, offset 0.014506, delay 0.0272421 Feb 17:17:01 ntpdate[85076]: adjust time server 10.210.208.8 offset 0.014506 secserver 10.210.208.8, stratum 4, offset -0.024885, delay 0.0271521 Feb 17:18:01 ntpdate[86124]: adjust time server 10.210.208.8 offset -0.024885 secserver 10.210.208.8, stratum 4, offset -0.339125, delay 0.0271121 Feb 17:19:01 ntpdate[86968]: adjust time server 10.210.208.8 offset -0.339125 secserver 10.210.208.8, stratum 4, offset -0.663019, delay 0.0450321 Feb 17:20:01 ntpdate[87306]: step time server 10.210.208.8 offset -0.663019 secserver 10.210.208.8, stratum 4, offset -0.977446, delay 0.0432021 Feb 17:21:01 ntpdate[87726]: step time server 10.210.208.8 offset -0.977446 secserver 10.210.208.8, stratum 4, offset -1.281264, delay 0.0272421 Feb 17:22:01 ntpdate[88035]: step time server 10.210.208.8 offset -1.281264 secserver 10.210.208.8, stratum 4, offset -1.597659, delay 0.0272421 Feb 17:23:01 ntpdate[88349]: step time server 10.210.208.8 offset -1.597659 secserver 10.210.208.8, stratum 4, offset -1.909921, delay 0.0271121 Feb 17:24:01 ntpdate[88669]: step time server 10.210.208.8 offset -1.909921 secserver 10.210.208.8, stratum 4, offset -2.227171, delay 0.0272121 Feb 17:25:01 ntpdate[89034]: step time server 10.210.208.8 offset -2.227171 secserver 10.210.208.8, stratum 4, offset -2.543663, delay 0.0272721 Feb 17:26:01 ntpdate[89454]: step time server 10.210.208.8 offset -2.543663 secserver 10.210.208.8, stratum 4, offset -2.860472, delay 0.0271021 Feb 17:27:01 ntpdate[90357]: step time server 10.210.208.8 offset -2.860472 secserver 10.210.208.8, stratum 4, offset -3.176871, delay 0.0272421 Feb 17:28:01 ntpdate[91362]: step time server 10.210.208.8 offset -3.176871 secserver 10.210.208.8, stratum 4, offset -3.493564, delay 0.0271321 Feb 17:29:01 ntpdate[92029]: step time server 10.210.208.8 offset -3.493564 secserver 10.210.208.8, stratum 4, offset -3.810247, delay 0.0272121 Feb 17:30:01 ntpdate[93076]: step time server 10.210.208.8 offset -3.810247 secserver 10.210.208.8, stratum 4, offset -4.126971, delay 0.0271021 Feb 17:31:02 ntpdate[94186]: step time server 10.210.208.8 offset -4.126971 secserver 10.210.208.8, stratum 4, offset -4.438399, delay 0.0271121 Feb 17:32:01 ntpdate[94848]: step time server 10.210.208.8 offset -4.438399 secserver 10.210.208.8, stratum 4, offset -4.754996, delay 0.0272421 Feb 17:33:01 ntpdate[95858]: step time server 10.210.208.8 offset -4.754996 secserver 10.210.208.8, stratum 4, offset -5.071533, delay 0.0271121 Feb 17:34:01 ntpdate[96992]: step time server 10.210.208.8 offset -5.071533 secserver 10.210.208.8, stratum 4, offset -5.388139, delay 0.02708

转载于:https://www.cnblogs.com/muahao/p/6426084.html

你可能感兴趣的文章
Glibc 和 uClibc
查看>>
VMware 虚拟机的虚拟磁盘编程知识点扫盲之二
查看>>
vs2012中自带IIS如何让其他电脑访问
查看>>
关于termux在手机上搭载Linux系统,python,ssh
查看>>
Redux:异步操作
查看>>
Mysql学习第三课-分析二进制日志进行增量备份和还原
查看>>
2-11
查看>>
POJ1961 Period [KMP应用]
查看>>
如何在 Android 手机上安装 Ubuntu 13.04
查看>>
HDU 6073 - Matching In Multiplication | 2017 Multi-University Training Contest 4
查看>>
C语言 scanf()和gets()函数的区别
查看>>
如何检测域名是否被微信屏蔽 微信域名检测接口API是如何实现
查看>>
POJ1611-The Suspects
查看>>
Spring 中 ApplicationContext 和 BeanFactory 的区别
查看>>
Linux下安装Python-3.3.2【转】
查看>>
LeetCode OJ:Merge Two Sorted Lists(合并两个链表)
查看>>
功能测试
查看>>
【BZOJ 1901】Dynamic Rankings
查看>>
阿里架构师都在学的知识体系
查看>>
PAT (Advanced Level) 1028. List Sorting (25)
查看>>