To download NI software, including the products shown below, visit ni.com/downloads.
Description
This example computes the difference between current time and UTC time and then builds time string in Etc/GMT+-X format. The time zone is set to target devices using Set Time VI.
Requirements
LabVIEW 2012 Full edition (or compatible)
NI System Configuration driver package
Steps to Implement or Execute Code
Additional Information or Resources
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
This VI has helped a great deal in attempting to keep the time sync'd between a cRIO and a Windows machine. However, I did notice that the "Changes Require Restart" output is set after running the VI. Do I really have to restart my cRIO after running this VI?
Hi fps,
Yes. If "changes require restart" returns True, run the Restart VI. Please find details at LabVIEW Help.
I think there is a potential bug in this block diagram. Wiring False constant to terminal to UTC? of Seconds to Date/Time not and True to is UTC? Date/Time to Seconds node gives unexpected time output. Instead, using using one more Seconds to Date/Time as below fixes the issue. I tested for IST and you can see the difference.
Hi,
I cannot figure out what the code should look like when the RT Controller should be set to a time zone deviating from UTC buy more than an integer hour. E.g. Katmandu is at GMT+5:45 and Tehran at GMT+3:30. It should be possible since I can find the alternatives in the time settings via NI MAX. For Katmandu I have tried all formats I could imagine including 'Etc/GMT'+.... '-0545', '-545', '5,45', '-5.45', '-5:45', '-5.75 ', '-5,75', '-0575', '-575'. All rendered an error message and no changed time zone. Anyone have any idea or possibly the answer? Would be very much appreciated.
I solved my problem using a ring control mapping odd time zone's strings (taken from twiki.org/) to their UTC offsets. A bit ugly but it works. Tried for all odd time zones during normal and daylight saving time. Does not work when automatic DST is off at the host computer and on at the RT controller.
SetTimeZoneRT [all time zones + DST]