简体   繁体   中英

How to automatically check hwclock?

I'd like to check whether my hardware clock is set correctly.

At first I thought that I'd use the last two fields returned by hwclock --show :

hwclock --show | awk '{print $8}'
-0.236936

But later I realized that it is NOT the difference between the system clock and the hardware clock:

date && hwclock
Mon May 27 17:21:34 CEST 2013
Sat 25 May 2013 12:21:35 PM CEST  -0.808630 seconds

(Btw: What's this number? It doesn't seem to be the hardware clock drift, as it always changes. Also it doesn't seem to be consistent with /etc/adjtime )

So here is my question: How can I check the difference between my system clock and my hardware clock?

I don't see any 'timestamp' option that could make it simple to substract both values.

It looks like:

hwclock --compare

will do what you want. This compare the system time against the HW clock time. It does this continuously at 5 second intervals allowing it to compute the PPM drift between the two clocks.

If you are running NTP this will periodically update the RTC (every 11 minutes I believe) which will affect the accuracy of the comparison.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM