LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare timestamps from waveform will not work

Solved!
Go to solution

Hi,

 

I try to search for a special timestamp in an array of timestamps (created from a waveform of a daqmx-data-acquisition).

 

But the precision of the timestamp is too high and the timestamp never match (att. file).

 

I`ve tried to change the microseconds to 3 decimal digits, but it will not work.

 

Two questions to this topic:

 

1. is it possible, that I got directly from daqmx a waveform with only 3 decimal (and after that only "0")

2. how can I change the incoming timestamp to 3 decimal (I´ve tried to convert in a string and then back with "%<%x %.3X>T" --> but no effect)

 

Thanks for your help.

0 Kudos
Message 1 of 5
(875 Views)
Solution
Accepted by topic author Tanchris

Hi Tanchris,

 

generic rule: NEVER compare float numbers for equality!

 

Better approach: search the minimum for abs(TimestampArray - Timestamp):

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(870 Views)

That works...yeah... Thanks a lot GerdW.

 

Do you know, is there also a way, to cut the timestamp before I compare it or has a timestamp ever its highest solution?

0 Kudos
Message 3 of 5
(863 Views)

Hi Tanchris,

 


@Tanchris wrote:

Do you know, is there also a way, to cut the timestamp before I compare it or has a timestamp ever its highest solution?


A timestamp is a timestamp. It consists of 128 bits, with 64 bits counting seconds since epoch and 64 bits for fractions of a second. You may fiddle with the timestamp value (using DateTimeToSeconds and SecondsToDateTime just to change the fraction part), but why?

Measurement data should be kept in full resolution, you can handle anything in post-processing…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(852 Views)

Thats right and I´ll do it with your snippit...

 

Have a nice day...thanks for support...

0 Kudos
Message 5 of 5
(823 Views)