You are not logged in.
After a few weeks the clock lags behind by several minutes. I already tried deleting the adjtime file but that didn't help. I don't want to use ntp because it can mess up log files and is not really a solution but just a "hack" to work around.
Edit: This is fairly new hardware maybe a year old, so I don't think it's a hardware fault. The PC is always on anyway so it doesn't rely on battery.
Last edited by mir91 (2014-05-08 09:30:04)
Offline
What are your settings? Try:
hwlock --debugOffline
Unless your computer includes a professional atomic clock, drift should be expected. Using ntp to adjust the system clock is not a "hack" any more than using a bicycle pump to restore lost pressure in your bicycle tires every few weeks. With the daemon properly configured, ntp will adjust the clock in very small increments to avoid messing up your log files. This is exactly what it is designed to do. As long as you're not just cron'ing "ntpd -qg" there should be no problem.
I don't believe there is any way for you to adjust the physical properties of the onboard clock so any compensation must be done through software. You need something that can determine when the clock is drifting, so in the absence of a second, reliable onboard clock you will have to check the time against an external clock (while considering latency to ensure an accurate comparison). You then need to adjust the system clock to this new time. You need to do this constantly as there will always be drift due to the physical properties of the onboard clock. This is what ntp does.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
The hardware clock on most computers is not particularly good at keeping time, and almost all will drift by a few minutes over several weeks. I have been running chrony on all my machines for a long time and it does not interfere with any of the timing functions when it is set up and running. This keeps the system clock synchronised to high accuracy and will write the current synchronised time to the RTC when you shut down.
https://wiki.archlinux.org/index.php/Chrony
If you do install and run chrony make sure that you have all the following files:
$ ls /etc/chrony*
/etc/chrony.conf /etc/chrony.drift /etc/chrony.keys /etc/chrony.rtcYou can start the daemon using systemctl (and of course enable it to start at boot) but you can also execute chrony from the command line at the same time to check settings using chronyc
Mike C
Offline
What are your settings? Try:
hwlock --debug
$ hwclock --debug
hwclock from util-linux 2.24.1
Using /dev interface to clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2014/05/10 08:57:10
Hw clock time : 2014/05/10 08:57:10 = 1399712230 seconds since 1969
Sat 10 May 2014 10:57:10 CEST -0.422601 secondsAbout ntp, wouldn't it be possible to have ntp somehow measure my clock's drift (for example over the period of one week) and adjust adjtime file accordingly, so that the clock would, from then on, run fine without having to run ntp or be connected to the internet at all any more?
Last edited by mir91 (2014-05-10 09:10:12)
Offline
The drift is often not static, but can vary depending on many different factors like temperature, voltage, EMI etc. That said, chrony usually does a half-decent job at keeping the time accurate even when offline.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
totte wrote:What are your settings? Try:
hwlock --debug$ hwclock --debug hwclock from util-linux 2.24.1 Using /dev interface to clock. Assuming hardware clock is kept in UTC time. Waiting for clock tick... ...got clock tick Time read from Hardware Clock: 2014/05/10 08:57:10 Hw clock time : 2014/05/10 08:57:10 = 1399712230 seconds since 1969 Sat 10 May 2014 10:57:10 CEST -0.422601 secondsAbout ntp, wouldn't it be possible to have ntp somehow measure my clock's drift (for example over the period of one week) and adjust adjtime file accordingly, so that the clock would, from then on, run fine without having to run ntp or be connected to the internet at all any more?
NTP actually does this. The issue is in the instability of the underlying RTC oscillator even with compensation. If it were that easy, there wouldn't be a market for atomic standards of the sort that the NTP servers themselves use to set their clocks.
Offline
Thanks, but what I don't understand is that according to http://en.wikipedia.org/wiki/Quartz_clock#Accuracy the error of a quartz clock is up to 15 seconds over 30 days, and quartz clocks are used in PCs, aren't they? So why do PCs drift for many minutes over a month while cheapest quartz watches are in line with the accuracy specified in that wikipedia article..?
Offline
It is possible that even a cheap quartz wristwatch uses more sophisticated clock design than the RTC in many motherboards.
Given the rather poor typical drift in the RTC I would not be surprised if it is not actually a quartz clock at all, but a simple LC oscillator circuit that is part of the large integrated circuitry on the motherboard or the BIOS chip, and kept supplied with power by the CMOS battery that keeps the clock powered up when the computer is not connected to external power. If that is the case then it is not too surprising that it drifts like fury, since the temperature of the board will vary with CPU use and with external temperature variations.
I have always taken it for granted that without external time synchronisation the internal RTC is likely to be out of sync by some minutes per week. Hence it is essential in linux to run one of the time synchronisation daemons such as NTPD or CHRONYD. These will keep the system clock in sync to within a few microseconds of the world's atomic time clocks, and when shutting down will, if set up right, write the current time to the RTC, which will then have a reasonable starting time at the next bootup unless the machine is left for some weeks before it is next booted up. Either way even if the RTC is out by several minutes when booting up, if the ntp or chrony daemons are started by default during boot then within a few minutes the system clock will be back to within microseconds of atomic time.
I don't know of any way to improve on that for a machine that is not networked but perhaps there are accurate clocks that can be connected to a computer (say via usb?) that could provide a sunc time for the operating system to use as system time, but perhaps someone more knowledgeable than me will explain if that is possible or not.
Mike C
Offline
Many older computers had the RTC derived from the frequency of your power supply..... Great fun when you weren't getting exactly 50/60Hz
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
I don't know of any way to improve on that for a machine that is not networked but perhaps there are accurate clocks that can be connected to a computer (say via usb?) that could provide a sunc time for the operating system to use as system time, but perhaps someone more knowledgeable than me will explain if that is possible or not.
You can use a GPS reciever. I'm not sure how accurate they are via USB (probably only to around a few tenths of a second), but if you connect them to a device with a serial input such as a Raspberry Pi you can get down to ms accuracy.
Offline
Lol, I started Chrony and suddenly my audio was playing faster than usual and was full of pops/clicks.
Not impressed. :-p
Fortunately it went back to normal immediately on issuing "systemctl stop chrony".
Last edited by mir91 (2014-05-20 02:30:59)
Offline
The hardware clock on most computers is not particularly good at keeping time, and almost all will drift by a few minutes over several weeks. I have been running chrony on all my machines for a long time and it does not interfere with any of the timing functions when it is set up and running. This keeps the system clock synchronised to high accuracy and will write the current synchronised time to the RTC when you shut down.
https://wiki.archlinux.org/index.php/Chrony
If you do install and run chrony make sure that you have all the following files:
$ ls /etc/chrony* /etc/chrony.conf /etc/chrony.drift /etc/chrony.keys /etc/chrony.rtcYou can start the daemon using systemctl (and of course enable it to start at boot) but you can also execute chrony from the command line at the same time to check settings using chronyc
What do you mean by "make sure you have all the files"? I don't have those, so what does that mean now?
Edit: I mean I only have the chrony.conf file
Last edited by mir91 (2014-05-20 03:10:59)
Offline
Hopefully when you have chrony.conf set for your use-case, then start the daemon it should create the necessary files except the chrony.keys file which you need to create manually. There is useful information at https://wiki.archlinux.org/index.php/Chrony and http://chrony.tuxfamily.org/manual.html (and https://access.redhat.com/site/document … ation.html and http://docs.fedoraproject.org/en-US/Fed … uite.html)
I hope this helps.
Last edited by mcloaked (2014-05-20 08:57:39)
Mike C
Offline
Hopefully when you have chrony.conf set for your use-case, then start the daemon it should create the necessary files except the chrony.keys file which you need to create manually. There is useful information at https://wiki.archlinux.org/index.php/Chrony and http://chrony.tuxfamily.org/manual.html (and https://access.redhat.com/site/document … ation.html and http://docs.fedoraproject.org/en-US/Fed … uite.html)
I hope this helps.
Well, I read the whole arch wiki entry of course, installed it, edited the .conf file to enable servers, and started the daemon.
It did not create those missing files, but I do now have a file /var/lib/chrony/drift.
As I wrote, while the chrony daemon is running, my sound is playing faster/pitched up though, and full of pops/clicks (was listening to some music).
Stopping the daemon immediately returns it to normal.
Last edited by mir91 (2014-05-20 09:57:47)
Offline
Well, I read the whole arch wiki entry of course, installed it, edited the .conf file to enable servers, and started the daemon.
It did not create those missing files, but I do now have a file /var/lib/chrony/drift.As I wrote, while the chrony daemon is running, my sound is playing faster/pitched up though, and full of pops/clicks (was listening to some music).
Stopping the daemon immediately returns it to normal.
It is really odd that the daemon running in the background should have such an impact unless you are stressing the CPU to the maximum. After all the daemon does some initial setup when it starts and then does time synchronisation with the servers at slowly decreasing frequencies - once it is synchronised the time is only resynced a couple of times an hour. On my system the following command shows that it resyncs every 20 minutes or so and has negligible impact on the system so I don't even notice it being there:
$ chronyc tracking
Reference ID : 46.8.40.31 (ntp1.regnets.ru)
Stratum : 2
Ref time (UTC) : Tue May 20 14:00:58 2014
System time : 0.000096842 seconds slow of NTP time
Last offset : 0.000017825 seconds
RMS offset : 0.000164208 seconds
Frequency : 19.987 ppm slow
Residual freq : -0.000 ppm
Skew : 0.050 ppm
Root delay : 0.112539 seconds
Root dispersion : 0.001759 seconds
Update interval : 1037.8 seconds
Leap status : NormalWhat is your hardware out of interest? I have chrony running on 6 family desktops and laptops altogether and none have any problems at all with the daemon running, and never had since using chrony for several years.
Mike C
Offline
One question. Does the error increase over time? Or is there a fixed delta?
Also, most modern machines will use 32.768 kHz Tuning Fork style crystals for the real time clock. They should hold 100 PPM.
Edit. BTW, there are about 2.6 million seconds / month. So, at the end of 1 month, I would expect (up to) a 260 second error. Between four and five minutes.
Of course, vendors could pick the 20 ppm part, but they cost more.
Last edited by ewaller (2014-05-20 21:22:57)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
@mcloaked:
It's a core i7 notebook and usually at around 5-10% cpu load at most (8 GB RAM).
@ewaller:
It seems to me as if each time I adjust the clock it will then take about 4 weeks for it go drift apart by ~5 minutes or so. So everytime the same error/fixed drift I guess.
Offline