LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timestamp as simple long

Solved!
Go to solution
This should be an easy one. I would like to obtain a timestamp in simple long format. The timestamp to seconds gives me this in some weird format that I can't cast to a long. How can I convert it to this basic format?
0 Kudos
Message 1 of 4
(3,529 Views)

Use the numeric conversion functions to make it a U32.  Since it will now be an integer, the fractional part of the seconds will disappear, but I assume you don't care about that since you are asking for an integer.

Message Edited by Ravens Fan on 05-19-2009 01:21 PM
0 Kudos
Message 2 of 4
(3,526 Views)
Solution
Accepted by topic author Steve_Block

Hi Steve,

 

you could convert to an U32 like shown in the attachment...

You can't use I32 as timestamp is out of range already. But you could make your own timestamp, for instance as "second since 1.1.1980" when you want to use I32...

 

@ravens fan:

In LV7.1 you can't convert a timestamp directly to U32 - one more reason to upgrade Smiley Very Happy

Message Edited by GerdW on 05-19-2009 07:23 PM
Best regards,
GerdW


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

The timestamp is a signed 128 bit fixed point number.  The decimal point is in the center.  You can typecast it to a cluster of two 64 bit integers or four 32 bit integers in any version of LabVIEW it is supported.  The first element will be the high bits.  Current timestamps are on the order of 3 X 109.  This puts them out of the range of I32s and barely in the range of U32s.

 

I will second Gerd's suggestion to create your own epoch.  You can do this easily by simply subtracting the timestamp of your epoch from the original timestamp.  If your version of LabVIEW does not natively support subtraction of timestamps, check out <vi.lib>\Waveform\TSOps.llb.  It contains some timestamp utilities which may be of use.  They also demonstrate the typecast to a cluster method of manipulating timestamps.

Message 4 of 4
(3,487 Views)