1

I have a program that runs on Raspberry PI that is completely depended on localtime. Otherwise, it will completely FAIL. On a Linux system like Magiea, it doesn't have any issues running as it should. However, when the same program is run on Raspberry PI, it FAILS. So, I am thinking it has to do with system time. Is it true that Raspberry PI uses UTC time instead of localtime for its system time even though you have set your local date and time?

1 Answer 1

5

Generally GNU/Linux systems presume the hardware clock is in UTC; I don't know if Magiea is an exception to that but it would be an odd thing to do. System time, which exists only in memory, is then calculated based on the locale time settings presuming the clock is UTC.

One good reason to do this is RTC (hardware) clocks won't compensate for daylight savings, etc., so this must be done by the OS anyway -- you can't use just a hardware clock set to local time. Raspbian is no exception, except of course the Pi does not actually have a hardware clock (unless you attach one). So it starts up and uses either a time saved from the last shutdown, or the UNIX epoch, which is 0:00:00 1/1/1970 (although you may get something offset one way or another from that); if it is online, ntpd should correct the time within a minute of boot. Prior to that the time will be behind.

If it isn't online, or you need to boot starting with the correct time, you need an RTC.

If you have not configured your time zone via raspi-config, then the system time will not be correct. If you have, then date and other application software will use the correctly adjusted system time, which is local time, not UTC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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