1

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 !

11
  • My system outputs properly. Anyway, you can debug starting by executing date command manually, every 1 second to check out if it reports the same
    – mattia.b89
    Jun 14, 2020 at 14:12
  • @mattia.b89 This is what they are doing with watch -n 1 date.
    – Kusalananda
    Jun 14, 2020 at 14:24
  • It is not clear what you mean by hwclock "working good". Can you show an example of e.g. watch -n 1 'date;whclock' or something similar that shows date misbehaving while hwclock does not?
    – Kusalananda
    Jun 14, 2020 at 14:26
  • @Kusalananda When I say the hwclock is working good I mean that every 1 sec he proceeds to the next second without those skipping that date does. I'm not near the PC now but I think it's pretty clear what I mean by that. (In the example that I've posted on the date command, think that hwclock will show me the correct time from 08:29:44 to 08:29:52 without any skipping) Jun 14, 2020 at 14:33
  • 1
    Could you post the output of 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. Jun 14, 2020 at 18:05

1 Answer 1

0

I just wanted to update, it was a hardware issue (something with the CPU itself) replacing the machine (a server) solved the issue.

Thanks anyway for the answers!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .