I've created a VI that does just this and posted it on the community examples. You can view it at http://decibel.ni.com/content/docs/DOC-3644.
Basically to get around the timezone issue that Odd_Modem pointed out it queries the timezone data from the kernel32.dll in windows then subtracts out this offset.
Regards,
Steven Zittrower
Applications Engineer
National Instruments
StevieZ, I don't believe your method is necessary. That is, there isn't a "time zone" issue to deal with. I've attached a VI that demonstrates this.
Here is a simpler (and OS independent) method to get the timezone offset.
Ton
ceger wrote:
Very nice, Ton. But what I'm attempting to demonstrate is that the timezone offset is not needed if one is simply trying to determine the current Unix (POSIX) time. All that is needed is to subtract a constant, timezone independent value from the LV timestamp.
Indeed and you can determine that offset once and then use it as a simple numeric in all your diagrams.
For the curious ones the interesting part that ceger refers to is all at the right border of his VI in the box. What you see there is all that is needed to convert LabVIEW time from its epoch into a different epoch.
ceger wrote:
Very nice, Ton. But what I'm attempting to demonstrate is that the timezone offset is not needed if one is simply trying to determine the current Unix (POSIX) time. All that is needed is to subtract a constant, timezone independent value from the LV timestamp.
Yes I know, I was posting the code to provide a non-os dependent way to get the timezone offset.
Especially since the Windows version came from an NI member.
Ton
Hi,
I need information for convert LV Date/Time to Unix time on sbRIO9631.
I have seen the example, but I have a
different time between PC and sbRIO (sbRIO: 2010/04/09 07:22:33 and PC: 2010/04/09 16:22:33).
I need to synchronize the time!
If anyone can help?
Thanks a lot!
md71