LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Higher precision of timestamp when wrinting to txt

Hello,
 
I would like to have a higher precision (--->miliseconds) of the timestamp when saving waveforms to .txt. Labview only prints the date and the time in HH:MM:SS. As I am acquiring data with a rate of 1k, 1000 data values have the same time description in the .txt-file.
Note: This problem only occurs when writing to .txt, it is no problem to get a higher precision by using the graph or the chart. 
 
Any help or suggestions would be appreciated.
0 Kudos
Message 1 of 7
(3,593 Views)

Hi Maurader,

There's probably an easer way, but I wrote this VI to obtain timestamps with ms accuracy.

At first I just stripped ms out of the DBL and appended it to the values you're already using.  But, then, out-of-order time-stamps appeared in the data - because the "Seconds" value is rounded (so "Seconds" would increment too soon...)

Beware though, this VI does not adjust for Daylight savings time.

Cheers.

Message Edited by Dynamik on 03-05-2006 04:13 PM

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 2 of 7
(3,595 Views)

... just to follow-up before catching any flack for a [way-]overly-complex solution/offering...

Timestamps generated from LabVIEW's "Seconds to DateTime" will (i think) reflect Daylight-Savings-Time changes.  So if a test-record bridges one of the DST transitions, it would be susceptible to inconsistent time-stamps (though, I expect there's an OS switch to disable DST.)

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 3 of 7
(3,572 Views)
You can use the Format Into String primitve with the timestamp to produce any sort of output you want.  The format strings are a bit complex, but they shouldn't hold back.  You can easily generate a format string by playing with the display format on a timestamp control or block diagram constant.  Use the advanced editing mode.

If you want even more control (and a lot more pain), I can post some VIs which create a text version of the timestamp (actually a 128 bit fixed point number) to full resolution.  Let me know and I will try to find them.

Note that if you get timestamps from the system clock, you will be limited to ms resolution in any case.  If you are getting it from your hardware device (NI-DAQ, NI-SCOPE, etc.) this will not be a problem.  The timestamp format itself has resolution down to the femtosecond level.  It is typically limited by the device generating the timestamp.
0 Kudos
Message 4 of 7
(3,554 Views)
Thanks so far.....
 
Maybe I was not precise enough. What I am looking for is the opportunity to easily manipulate the format of  the timestamp, which comes with my data and then write it to .txt. I already used the "Format Date/Time String"-VI to get the time with the miliseconds part and joined this time information with the data of the waveforms, which I also had to extract from the waveforms before, afterwards, but I thought there would be a more elegant way, because if I can extract the ms-part from the timestamp it must have been in it before, right ? 😉 So why can´t I tell Labview to also display the ms-part, when using the "write waveforms to .txt"-VI? I attached a .txt-file with a short excerpt of data, which should visualise the problem.
 
 
Regards

Message Edited by Marauder on 03-10-2006 03:20 PM

0 Kudos
Message 5 of 7
(3,534 Views)
The Format Data/Time String primitive can be used to produce the entire string.  See the attached example.  See the LabVIEW help file under time format codes for all the possibilities.
0 Kudos
Message 6 of 7
(3,509 Views)
In spite of little interest in ths DST-independent SecondsToDate/Time function, here it is again, fixed (the first one was off by 1 hr because it was validated during DST.) 
 
Use LabVIEW's functions (SecondsToDT, Format DT To String)
if you don't mind the time's being shifted as described here and here.
 
 
 
 
When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 7 of 7
(3,481 Views)