I got a weird scenario in which the date of my computer is getting the wrong time (and he keeps fixing the time but still keep repeating this issue)
let me share with you an example who make this much more understandable: let's say I'm running this command:
watch -n 1 'date'
this is my output:
Sun Jun 14 08:29:44 CDT 2020
Sun Jun 14 08:29:45 CDT 2020
Sun Jun 14 08:29:46 CDT 2020
Sun Jun 14 08:29:50 CDT 2020
Sun Jun 14 08:29:51 CDT 2020
Sun Jun 14 08:29:49 CDT 2020
Sun Jun 14 08:29:50 CDT 2020
Sun Jun 14 08:29:51 CDT 2020
Sun Jun 14 08:29:52 CDT 2020
this is happening over and over again.
First, I was getting my time from an NTP server, so I thought the NTP server has an issue, but even when I turned off the NTP server this is still happening.
Second, I thought maybe the HWclock is not working well, but when I ran watch on hwclock it's working just fine
(if I run watch hwlock;date
I can see that hwclock is working good but the date got the issue described earlier)
I'm using Linux red-hat
anyone can suggest how could I debug it? I want to understand why it's happening, and who has the fault.
Thanks !
date
command manually, every 1 second to check out if it reports the samewatch -n 1 date
.hwclock
"working good". Can you show an example of e.g.watch -n 1 'date;whclock'
or something similar that showsdate
misbehaving whilehwclock
does not?sudo bash -c 'while sleep 1;do hwclock;date "+%F %T";echo; done'
for some seconds so that we can see hwclock working while date doesn't? It doesn't have to be the exact command. They are not going to show the same time, but the difference should be constant.