LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change timestamp to a float?

Hello,

 

I'm trying to collect information on an MSO64B O-scope: specifically, I need the time step dt, data values, and starting time t0.  In the program I'm using, I'm able to easily get the dt and data values, but the starting time is displayed as a time/date format, as shown below.

 

LTiger91_0-1675122551009.png

 

I want to change it to be in a simple format of a single number, such as -1.25e-9.

How would I go about changing that?  Is it possible?

 

For reference, I'm using Labview 2022 Q3 version, and am utilizing the free MSO library, with the data capture VI shown below:

LTiger91_2-1675123468126.png

 

 

Thanks in advance for any help.

 

 

0 Kudos
Message 1 of 5
(833 Views)

Well, there is a function that converts it, though I'm not sure it will do what you think it will:

 

https://www.ni.com/docs/en-US/bundle/labview/page/glang/to_double_precision_float.html

 

If you convert "now" into a float in that manner, you get 3.75797E+9, which is a far cry from what you said you were looking for, "such as -1.25e-9".  

 

It's the number of seconds since January 1, 1904...

0 Kudos
Message 2 of 5
(824 Views)

Converting a timestamp to  floating point is as simple as this:

Time3.PNG

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 5
(807 Views)

Thanks for the help!

 

So how do you recommend I change it to the value I'm looking for?  If the start point for the scope is some number of nanoseconds before the data is captured, is there a way to extract that data?

0 Kudos
Message 4 of 5
(737 Views)

Set the timestamp to Relative Time instead of Absolute Time.

 

If you can't then use your trigger point or your first sample as T0.

 

Subtract T0 from all the timestamps to get relative time.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 5
(729 Views)