Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Running on the CentOS 7.2 with the base kernel we are experiencing severe drift between the hwclock and software clock. NTP and Chrony are not running. I synchronized the software and hardware clock a little over 12 hours ago and now the systems are about and hour and 37 minutes apart:
Assuming this is a physical and not a virtual machine. The two clocks are totally independent of each other. The hardware clock which sole purpose is to set the system clock at boot time is an IC chip and as configured is only updated when you shutdown the computer or manually set. It can drift due to voltage and temperature.
The system clock i.e. what you see with the output of the date command is a software counter based upon a timer interrupt. The timer interrupt used may not be exact so it will either be slow or fast. There is a drift factor that can be adjusted which is stored in the /etc/adjtime file.
The hardware clock can be referenced to local or UTC time and the output always displays its actual time i.e. does not convert to local time despite the fact that it outputs a timezone. linux defaults to UTC as the hardware clock reference which is also stored in the /etc/adjtime file.
So this is more or less normal which is why most run ntp or connect to a stable time source.
Most frequently, one machine on the network will very-regularly sync its clock using ntpd to some public atomic-time source, and then every other computer will sync to it. Absent this, the system clock can – as you saw – drift badly.
We have to run PTP for our time protocol. In most cases it runs great but at one site I am getting the following error. And from what I have read this usually means something else is affecting the system clock and I thought this extreme drift was an indication that something was affecting the clock. I just can't tell what program or driver.
systemctl status ptp4l phc2sys
● ptp4l.service - Precision Time Protocol (PTP) service
Loaded: loaded (/usr/lib/systemd/system/ptp4l.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2017-04-20 18:40:26 CDT; 16min ago
Process: 16134 ExecStartPre=/usr/local/sbin/hwstamp_ctl -i ens2 -r 1 -t 1 (code=exited, status=0/SUCCESS)
Main PID: 16139 (ptp4l)
CGroup: /system.slice/ptp4l.service
└─16139 /usr/local/sbin/ptp4l -f /etc/ptp4l.conf -i ens2.172 -p /dev/ptp2
Not all that familiar with PTP but s0 means the clock is unlocked. Has this one computer ever been able to sync correctly? Is the hardware the same on all computers?
I'm only guessing but are you using the correct phc device i.e. /dev/ptp2?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.