LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI to convert LabVIEW time to Unix time

The difference you see is because your sbRIO target uses UTC time and your desktop uses local timezone. There is no simple solution to fix that since VxWorks has limited support for timezone settings. Easiest is to only work in absolute timestamps on the RIO platform, since that value is ALWAYS in UTC. Once you convert an absolute timestamp to a display form of any kind, this applies the timezone offset of the system, which for a desktop computer is usually the local timezone offset and for realtime targets is 0 since they normally operate with UTC.
Message Edited by rolfk on 04-09-2010 05:28 PM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 11 of 16
(4,989 Views)

Tanks for reply !

 

But sbRIO work with UTC ( 2010/04/09 07:22:33 ) and my localtime is CET=(UTC + 1h) or CEST=(UTC + 2h)  ( PC: 2010/04/09 16:22:33 CEST).

I have 8 or 9 hours of difference !!! 

I do not understand, I would expect a difference in the 1 or 2 hours.

 

md71

Message Edited by md71 on 04-09-2010 11:03 AM
0 Kudos
Message 12 of 16
(4,975 Views)
Then the RTC in your sbRIO has not been set correctly! Not sure if MAX supports to change RIO time, but there is a VI in the palettes that allows reading and setting the time for real-time targets. You can write a VI that runs on the realtime target and uses those VIs and either execute it interactively or somehow integrate it in your remote control protocol if you have one implemented for your realtime app.
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 13 of 16
(4,955 Views)

The difference in seconds betwwen the two appears to be 2,082,862,800 seconds.  Subtract or add depending on which way you are converting.

-Scott
0 Kudos
Message 14 of 16
(3,571 Views)

I know it's an old post.. but this thread sent me down a rabbit hold I didn't have to go down.  In hopes of helping folks in the future that may stumble on this thread...

 

I think the short answer, to anyone else looking, is to download the Epoch Date & Time package via VIPM

 

Epoch Date & Time Toolkit for LabVIEW - Download - VIPM by JKI

Message 15 of 16
(187 Views)

Good to mention the alternative. This topic is a rabbit hole, and a deep one no matter what you do when you start. The reason this thread didn't mention that library is that the first post was in 2005, with earlier ones in other threads and the last one before yours in 2016. The library you mention is available since about 2020/2021.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 16 of 16
(172 Views)