LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linx on Raspi uses UTC

Solved!
Go to solution

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

0 Kudos
Message 1 of 15
(1,623 Views)

Is the time right?  You only mentioned the time zone was correct.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 15
(1,614 Views)

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

0 Kudos
Message 3 of 15
(1,578 Views)

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 15
(1,571 Views)

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!

0 Kudos
Message 5 of 15
(1,564 Views)
Solution
Accepted by topic author ed313

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.

Rolf Kalbermatter
My Blog
Message 6 of 15
(1,541 Views)

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 15
(1,515 Views)

@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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 15
(1,485 Views)

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

0 Kudos
Message 9 of 15
(1,477 Views)

@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".

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 15
(1,455 Views)