01-24-2023 07:07 AM
Hello,
I made a program with LabView Community running on a Raspi 3B where I need the local Time (UTC +1). Time Zone settings on the Pi are correct, but nevertheless it uses UTC. I get the Time by Format Date/Time, UTC Option is not used. Does anyone know this problem? What can I do?
Thanks
Ed
Solved! Go to Solution.
01-24-2023 07:35 AM
Is the time right? You only mentioned the time zone was correct.
01-24-2023 10:00 AM
Hi,
yes, the time is right, it is set by ntp. The raspi just ignores the time zone. I'm afraid the Pi uses UTC as system time and adds the time zone just for display an the Time/date function referres to the system time. Maybe there is another way to get the local time into labview. When the program runs on the pc, time is correct
01-24-2023 10:31 AM
@ed313 wrote:
Hi,
yes, the time is right, it is set by ntp. The raspi just ignores the time zone. I'm afraid the Pi uses UTC as system time and adds the time zone just for display an the Time/date function referres to the system time. Maybe there is another way to get the local time into labview. When the program runs on the pc, time is correct
I think you pretty much described how every OS keeps track of time. Does your time zone have Daylight Saving? It can be tricky sometimes to get local time with DST. That's why IMO it's just better to use UTC with test data.
And I totally forgot that RPI uses NTP. Thanks for reminding me.
01-24-2023 11:45 AM
Hi,
I don't use aylght saving time. Its a program that calculates the position of the sun for tracking it with a solar panel. Not necessary but nice to have and nicer to do this. Just for fun. So when there is the wrong time I get the wrong position. Maybe I will try with a GPS Module, but since then I will just add an hour (and subtract 24 when at 25) as workaround. And sorry for the ntp, I just wanted to mention it, not more.
Thanks for help!
01-24-2023 12:38 PM - edited 01-24-2023 12:43 PM
The problem is that the settings in the Raspbian OS do not automatically apply to the Linx environment. The LabVIEW environment runs in its own embedded Linux OS derived from NI Linux real-time and this OS runs in a chroot environment inside the Raspbian OS. chroot is a lightweight Linux virtual machine solution.
Basically you have two OSes here, one is the Raspbian host OS and the other is the NI Linux embedded guest OS inside the chroot, which runs the LabVIEW runtime system in which your LabVIEW program gets deployed. The NI Linux OS has however no graphical user interface that lets you easily configure its settings. You have to figure out which configuration file you need to change inside the OS running in the chroot to get the clock to use a local time.
And yes every OS nowadays keeps running on UTC internally and the user interface components use the locale settings to transform this UTC time to the local time according to these settings. But each OS has its own settings and its the same as if you would run a Linux OS inside a VmWare VM on a Windows system. While both use the same realtime clock source on your PC, they will use whatever locale is configured in the according OS to display local time.
01-24-2023 07:31 PM
@rolfk wrote:
The problem is that the settings in the Raspbian OS do not automatically apply to the Linx environment. The LabVIEW environment runs in its own embedded Linux OS derived from NI Linux real-time and this OS runs in a chroot environment inside the Raspbian OS. chroot is a lightweight Linux virtual machine solution.
Basically you have two OSes here, one is the Raspbian host OS and the other is the NI Linux embedded guest OS inside the chroot, which runs the LabVIEW runtime system in which your LabVIEW program gets deployed. The NI Linux OS has however no graphical user interface that lets you easily configure its settings. You have to figure out which configuration file you need to change inside the OS running in the chroot to get the clock to use a local time.
And yes every OS nowadays keeps running on UTC internally and the user interface components use the locale settings to transform this UTC time to the local time according to these settings. But each OS has its own settings and its the same as if you would run a Linux OS inside a VmWare VM on a Windows system. While both use the same realtime clock source on your PC, they will use whatever locale is configured in the according OS to display local time.
Fascinating! That the NI virtual machine would not derive settings such as time from the parent OS did not occur to me.
01-25-2023 03:40 AM
@billko wrote:
Fascinating! That the NI virtual machine would not derive settings such as time from the parent OS did not occur to me.
That's a technically wrong statement. It of course does derive time from the host OS. It can't reinvent a real-time chip out of air. But that real-time value is always in UTC nowadays. How and to what local time format it is transformed is a function of the actual OS, and since the NI Linux system inside the chroot is its own OS it has also its own configuration for that.
01-25-2023 04:03 AM
Hi,
Because I don't think I will find the settings in the LynxOS (It's the second time I am working with the Pi within 4 years, so I am not really experienced with Linux) I made a workaround. I think it will be needed also with GPS Time.
Thanks for help!
Ed
01-25-2023 11:37 AM
@rolfk wrote:
@billko wrote:
Fascinating! That the NI virtual machine would not derive settings such as time from the parent OS did not occur to me.
That's a technically wrong statement. It of course does derive time from the host OS. It can't reinvent a real-time chip out of air. But that real-time value is always in UTC nowadays. How and to what local time format it is transformed is a function of the actual OS, and since the NI Linux system inside the chroot is its own OS it has also its own configuration for that.
I meant "time zone settings".