04-17-2009 03:05 PM
I am using the Set Date Time from NIST.vi that I found here on NI.com (http://zone.ni.com/devzone/cda/epd/p/id/2438). This works great! It gets the time in UTC, and sets it on the target. What I don't understand is that when I use Get Date/Time in Seconds to get the current time, it still shows as local time. RT Set Date and Time.vi has an enum that allows you to specify "set UTC time" and my controller is set to UTC in MAX. As far as I can tell, there shouldn't be any way for my controller to know where it is, yet it tells me my local time (GMT-4 currently). WHY? If I use Format Date/Time String, and input a True boolean into "UTC format", I get UTC out, but as far as I can tell, it should think its local time is UTC, and therefore give me the same time either way. Any help please?
Thanks,
Chris
04-20-2009 10:27 PM
Hello Chris,
Why are you specifying UTC time in both MAX and programmatically? This seems redundant to me. As for the Get Date/Time In Seconds VI, I think there may be an issue with running this VI after the controller's time has been set programmatically in that it will not reflect the changes. I will have to look into this some more though.
04-21-2009 08:45 AM - edited 04-21-2009 08:45 AM
These are the specific steps I've performed:
1) Open MAX, and select RT target under "Remote Systems".
- choose the System Settings tab
- set the Timezone to UTC
(if there is another way to set the timezone, I'd love to hear it; that may be the problem)
2) Create a project with my RT target, and place the "Set Date Time from NIST.vi" in the project under the target.
3) I created a wrapper vi that simply gets the current time, runs the "Set Date Time from NIST.vi", and then gets the current time again (in a sequence structure).
4) Run the vi. My local time is 09:30 Eastern. I set probes on the time and date clusters (see image).
- as you can see, the clusters contain UTC time, and the "RT Set Date and Time.vi" is set to use UTC time (I've tried switching it to Local time, but it makes no difference).
- "Get Date/Time in Seconds" still returns local time. I'm beginning to wonder if I need to fly the rio to Greenwich England before it will give me the correct time.
Is there some setting elsewhere that needs to be configured to set the timezone? I have rebooted the controller; that does not appear to be a contributing factor.
Chris
04-22-2009 06:47 PM
Thanks for the information. I have reproduced this issue and am looking into it. I will let you know what I find.
04-23-2009 02:43 PM
Hello Chris,
It turns out that the indicator that is created at the output of the Get Date/Time VI converts the value to the local time of your machine. Even though the correct value is there on the controller, the indicator manipulates it for you. This is technically a feature, but understandably has caused a deal of confusion. I believe you can get around this problem by wiring the output of the Get Date/Time VI to a Get Date/Time String VI. Then create indicators from the output of this VI. You should see the time you are expecting. I hope this helps!
04-24-2009 07:54 AM
Alright. So the best way to get local time off the RIO is to convert the time to a string before transferring it? When I do this, I specify False on the input to "Is UTC?" on "Date/Time to Seconds", and the timestamp I get back is 1 hour off. I'm guessing this has something to do with DST.
My thought was that I could avoid all the confusion about time zones and daylight savings by doing everything on the remote controller in UTC, but apparently that doesn't avoid confusion about the actual local time.
Thanks
Chris10-09-2012 03:22 PM
Hi Chris,
I thought I'd offer an alternative to getting the time from RT as a string. The timestamp data is always in UTC. However, the timestamp indicator will convert the UTC into the local time when it is displayed. To display a UTC timestamp in an indicator, you must change the format string for the indicator:
1) Right click on the Timestamp Indicator and select "Properties"
2) In the Display Format tab, select the "Advanced Editing Mode" radio button option. The default format string for a Timestamp is
%<%.3X
%x>T
3) If you add the "^" character, it will display the timestamp as UTC:
%^<%.3X
%x>T
I've attached a VI to show this behavior. I thought others might find this information useful, so I'm posting it even though this thread is very old. The attachment is a LabVIEW 2011 file showing two indicators; one displaying time as UTC, the other as local time.
04-11-2013 08:42 AM
Hi
Thank you very much for this information. This problem caused me a lot of frustration.
I tried to display the timestamp in UTC .
To solve that problem I added the "^" character.
I addition I wanted to make a header TDMS file with a timestamp. And that timestamp goes directly into the file.
I convert the file TDMS file into a tab delimited spreadsheet file (string).
And out I get the local time, not UTC.
Seems like it is not only the indicator wich make it difficult to get the UTC time out..
To solve that I had to convert the timestamp with the Format Date/Time String Function (UTC input TRUE) before I added that to the TDMS file.