3

I have two Pi 3 running at the same time with my program being executed while both are plugged into a power source with current date and time and not connected to the Internet. Couple of days later I noticed that both pi's date and time drifted so much that it is behind by 1 or 2 days late and even the time is far off. Not only that my program, which is supposed to run 24/7, is shutdown. I am starting to think that is due date and time drifting. So, I would like to know what would cause pi system date and time to drift while it is plugged into a power source and not connected to the Internet.

ThN
  • 1,042
  • 6
  • 19
  • 33
  • "*Couple of days later*" + "*it is behind by 2 or 3 days late*" = the clock stands still on one, more or less. Or do you have a different definition of "*couple*"? – techraf Dec 19 '16 at 14:37
  • @techraf You may very well be correct. Hypothetically speaking if I set their date and time today and checked back two days later, I would expect to see current date and time, but I don't see that. They are behind by a day or two always. It is the same in both PI's. – ThN Dec 19 '16 at 14:45
  • How exactly do you run `shutdown` 24/7? Or did I fail to parse that correctly? – Dmitry Grigoryev Dec 19 '16 at 14:45
  • "*Hypothetically speaking*"? Please stick to the hard facts. – techraf Dec 19 '16 at 14:47
  • 3
    I really doubt it is possible for the date to drift that much unless the power was cycled at some point. So probably you are asking the wrong question. You're looking for the Y side of an [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem/66378#66378), but you will never find it. – goldilocks Dec 19 '16 at 14:48
  • @DmitryGrigoryev My program is supposed to run until you yourself shutdown the program, but when I check on my pi's days later my program is no longer running and their system date and time is not current. All this while the pi's have continuous flow of power and not connected to the Internet. I am trying to find out if Pi's have built-in mechanism like a watchdog that will stop programs after sometimes for whatever reason. – ThN Dec 19 '16 at 15:49
  • 1
    This sounds like a power issue or an overloaded system. – Steve Robillard Dec 19 '16 at 17:57
  • Remember that the Rpi uses an internet connection to set the date, time, and locale. – Rowan Lerowsky Dec 19 '16 at 19:14
  • @NathanLerowsky Yes, I realize that. Isn't pie suppose to maintain its date and time once you set it up as long as there is power not requiring Internet? – ThN Dec 19 '16 at 20:31
  • Yes. You're right. – Rowan Lerowsky Dec 19 '16 at 20:52
  • Could your program be running out of memory and being stopped by the oomkiller process? Even if it's not designed to run out of memory, maybe test for memory leaks. Similarly, if your program runs out of SD card space it might stop, but shouldn't reset the Raspberry Pi if run with normal user privileges – scruss Jan 21 '17 at 16:14
  • That is simply what they do: https://raspberrypi.stackexchange.com/questions/1397/how-accurate-is-raspberry-pis-timekeeping – SDsolar Jun 20 '18 at 01:33

1 Answers1

2

If you shutdown the Pi, then restart it restores the time to that last saved, which it does periodically while running.

The "culprit" is fake-hwclock, although this is better than the default, which would set the time to 1970.

The Pi is designed to set its time from the internet using ntp - it has no RTC.

It is simple and cheap to add a RTC if you do want it to work without internet access.

dmesg -T | grep clock may give you some clue what the Pi is up to while booting.

Milliways
  • 54,718
  • 26
  • 92
  • 182