LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamp conversion problem.

Solved!
Go to solution
I work in the development of a LabVIEW program that communicates with a server (written in Java). All acquired data is sent via TCP and the server can read everything (waveforms and other information). However, there is a problem in timestamp conversion. We don't know how to convert the milliseconds correctly. The timestamp is inside a waveform, so we cannot convert it to formatted string.

Example:

Original timestamp:

13:37:19,639
11/10/2005

String generated with "Flatten to String":

0000 0000 BF71 9ABF A3D7 0800 0000 0000

Converted value (Java server):

13:37:19,000
11/10/2005


Does anyone know the algorithm to obtain the milliseconds from this value: "A3D7 0800"?

Thanks for attention.

My regards,
Vinicius Falseth




Message 1 of 8
(4,232 Views)
Solution
Accepted by topic author falseth
Hello Vinicius,

this pic should give you a hint...


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(4,214 Views)
Hi GerdW. Thanks for your suggestion. However it didn't fix the problem. See the attached image.

Vinicius.


0 Kudos
Message 3 of 8
(4,211 Views)
Hi GerdW. I tried the same thing in windows calculator and it really works. Thanks a lot.

Vinicius.
0 Kudos
Message 4 of 8
(4,193 Views)
Hello Vinicius,

I forgot to mention: you have to set the string constant to "Hex Display". Then insert "A3D7 0800" and you will get the desired result.
Sorry, my fault.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 8
(4,182 Views)
Hello GerdW. Don't worry about this. Your tip saved me a lot of time. I made your example with "Hexadecimal String To Number" vi and it worked perfectly. Thanks again.

Best regards,
Vinicius Falseth


0 Kudos
Message 6 of 8
(4,166 Views)
There is a faster way.  You can extract the timestamp from the waveform using Get Waveform Components.  At that point, you can convert it to whatever you want.  Attached is a VI which shows a simple conversion to milliseconds, losing a lot of resolution (128 bit timestamp goes to 52 bit double) and a more complex conversion showing the internal structure of the timestamp (it is a 128 bit fixed point number with the decimal in the middle).  You can modify the second conversion to do such things as throw away the integer portion to get higher resolution on the fraction.  Or you could just save to Java using a four-integer structure.
0 Kudos
Message 7 of 8
(4,127 Views)
Hi DFGray. The initial solution fits better to my needs. Thanks a lot for your interest.

Best regards,
Vinicius Falseth



0 Kudos
Message 8 of 8
(4,110 Views)