LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement this "simple" algorithm?

Solved!
Go to solution

Hello.

I'm attempting to understand the logical algorithm Labview uses to convert relative time to dbl. I know that absolute time is converted by the number of seconds elapsed passed epoch - is relative time the number of seconds, or miliseconds, or something else?

I'm attempting to control the visible time period on a waveform chart, so I want to make sure I understand how Labview handles timestamps.

Using Labview 2022, Windows 10
0 Kudos
Message 1 of 7
(2,950 Views)

Hi Allison,

 

"relative time" as a result of a subtraction of two timestamps is a value given in seconds.

You surely found out the same by creating a simple test VI:

check.png

Best regards,
GerdW


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

The absolute times that are shown (in a timestamps and doubles configured as absolute time) are just visualisations of seconds since epoch (1-1-1904 UTC). A timestamp value (e.g. constant) will display a different time on PC's configured with different time zones and\or different daytime correction options.

 

So you'll have your seconds since epoch, and the way this is displayed as date\time "string". The displayed string is "flexible", the value is fixed. The confusing part is that the way "absolute time" shown is not fixed (as it depends on target PC). Unless you set it to UTC.

 

If you convert to double, you'll always get the seconds since epoch. However, if you convert 6-6-2006 00:00:00 to timestamp, the seconds since epoch is only the same if you specify it's UTC. If you don't, the timestamp will show the correct date\time (e.g. 6-6-2006 00:00:00), but the seconds since epoch can be different.

 

It's not easy...

0 Kudos
Message 3 of 7
(2,868 Views)

wiebe@CARYA wrote:

The absolute times that are shown (in a timestamps and doubles configured as absolute time) are just visualisations of seconds since epoch (1-1-1904 UTC).

 


Minor modification to Wiebe's note -- Timestamps represent the difference between a date/time and the Epoch, and can be positive (if after 1 Jan 1904 UTC) or negative (e.g. 1 Jan 1900).  I vaguely recall trying to see "how far back" I could go -- as I recall, it was at least a few centuries, but less than a millenium ...

 

Bob Schor

0 Kudos
Message 4 of 7
(2,850 Views)

@Bob_Schor wrote:

wiebe@CARYA wrote:

The absolute times that are shown (in a timestamps and doubles configured as absolute time) are just visualisations of seconds since epoch (1-1-1904 UTC).

 


Minor modification to Wiebe's note -- Timestamps represent the difference between a date/time and the Epoch, and can be positive (if after 1 Jan 1904 UTC) or negative (e.g. 1 Jan 1900).  I vaguely recall trying to see "how far back" I could go -- as I recall, it was at least a few centuries, but less than a millenium ...

 

Bob Schor


The timestamps themselves can go very far, it's just the conversion to string (the visualisation) is limited (to max 3000, don't know the min.). Adding 8000 year to current and then subtracting 7000 years is no problem. But the intermediate result (current+8000) will display as the year 3000 (basically "overflow").

0 Kudos
Message 5 of 7
(2,842 Views)
Solution
Accepted by AllisonSCJ

To submit an answer to my own question:

 

The simply algorithm of relative and absolute time is, in fact, rather easy to understand. The strange part is how charts display it, and how you set increments on a chart.

 

If the chart is set to display time to the second, then the value you enter into the properties window of the chart will be evaluated as time in seconds. (example: if the first value of the chat is a value of 20, and the chart is set to seconds, relative time, then the first value of the chart will be 20 seconds, relative time. If the chart is set to display milliseconds, then the 20 is evaluated as 20 milli seconds).

 

My question ended up being less about relative and absolute time in Labview, and more about how Labview charts evaluate numerical values into relative and absolute timestamps

Using Labview 2022, Windows 10
0 Kudos
Message 6 of 7
(2,804 Views)

 


@Bob_Schor wrote:

wiebe@CARYA wrote:

The absolute times that are shown (in a timestamps and doubles configured as absolute time) are just visualisations of seconds since epoch (1-1-1904 UTC).

 


Minor modification to Wiebe's note -- Timestamps represent the difference between a date/time and the Epoch, and can be positive (if after 1 Jan 1904 UTC) or negative (e.g. 1 Jan 1900).  I vaguely recall trying to see "how far back" I could go -- as I recall, it was at least a few centuries, but less than a millenium ...

 

Bob Schor


I never knew this. Very interesting, thank you!

Using Labview 2022, Windows 10
0 Kudos
Message 7 of 7
(2,801 Views)