0

When I've booted my Raspberry Pi 3 into Raspbian, I've setup the /etc/profile to load a program though mono. However, the program now reports the wrong time (An hour behind on the previous day), though testing, I've found that it only happens though loading the program at boot as running it though the command line after booting works fine. What am I doing wrong?

2

What am I doing wrong?

Using /etc/profile to run a boot service. But that's not the cause of this particular problem.

The Pi does not have a real time clock like standard computers. The system has no way of knowing the actual time when booted. Raspbian uses an NTP client to get the correct current time from the network, but obviously this requires a connection to a network and may take tens of seconds to complete, during which time your program has already started.

Prior to getting an update via NTP, the system either uses the Unix epoch as the time (you may notice files time stamped 1969 or 1970 because of this) or else a timestamp created by the OS during the last run (I am not sure of the details; I believe it should happen at shutdown).

1
  • I think you're correct. My RPi runs a process which logs data against time. For info (I'm not sure of the means) but mine seems to pick up from the point it left off at. I.e. if I switch it off at 07:30, then switch it on 3.5 days later, it picks up at 07:30 for a minute or so until it picks up the NTP time. – KDM Mar 31 '17 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.