05-31-2019 04:46 AM
So I am trying to set a property in my TDMS file.
_waveformChannels[i].GetProperty("wf_start_time").SetValue<DateTime>( ... );
I checked while debugging. The DateTime object I want to write has the correct timing information. After I Write it with the line above it gets corrupted. The "wf_start_time" field in the finished file is always 2 hours off. Also I would like to force a 24 hour format like
"MM.DD.yyyy HH:mm:ss.fff"
Right now I am out of options. I didnt find something about it in the docs.
Greetings
Rizardus
Solved! Go to Solution.
07-10-2019 04:40 AM - edited 07-10-2019 04:48 AM
Hello Rizardus!
I assume that your timestamps are off by exactly 2 hours. This is because timestamps in TDMS files are always written in UTC. That way you won't run into trouble in case you have a measurement running while e.g. the local time zone switches between summer and winter time or a user changes the computer's local time zone.
+2 hour difference to UTC would match e.g. most of Western Europe.
Here is a forum thread that explains is a bit more in detail: TDMS: wf_start_time and time zone
Regarding the time format: Where do you see the 12h format? The tdms file itself is binary, so you are probably not looking at it directly using a hex editor. Are you seeing the 12h format on your application's UI? Or are you opening the tdms file with a tool, e.g. the Excel Addon? The format shown depends on the tool itself, not the tdms file.
Except you write the datetime into a string property; in that case you could use your languages function to format strings to convert datetime to a string in the format you need it. See Using Elapsed Time Formats with Measurement Studio Windows Forms Controls starting from section How Do I Create a Custom Elapsed Time Format? for some examples.
08-02-2019 02:03 AM
I converted TDMS to ASCII in my own application. Thanks I will check the formatting in the string there.