# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## How to implement this "simple" algorithm?

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.

Message 1 of 7
(744 Views)

## Re: How to implement this "simple" algorithm?

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:

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome

Message 2 of 7
(692 Views)

## Re: How to implement this "simple" algorithm?

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...

Message 3 of 7
(662 Views)

## Re: How to implement this "simple" algorithm?

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

Message 4 of 7
(644 Views)

## Re: How to implement this "simple" algorithm?

@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").

Message 5 of 7
(636 Views)
Solution
Accepted by topic author AllisonSCJ

## Re: How to implement this "simple" algorithm?

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

Message 6 of 7
(598 Views)

## Re: How to implement this "simple" algorithm?

@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!

Message 7 of 7
(595 Views)