LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subtraction between timestamps

Solved!
Go to solution

Good morning.


Working with subtraction between timestamp data, I'm encountering seemingly nonsensical behavior, which is becoming quite a headache for the algorithm I'm trying to develop.
Specifically, given that the subtraction between 2 timestamps gives me a double as a result, which effectively represents the number of seconds that elapse between the 2 instants, if I try to convert this number into a new timestamp, the result I get is invariably a hour more than the actual difference between the 2 times.

 

guada_bl_0-1712147897201.png

 

What is it that's slipping away?

 

Thanks to everyone who can give me a hand

 

 

 

0 Kudos
Message 1 of 5
(21,366 Views)
Solution
Accepted by topic author guada_bl

Try to convert just 1 second with and without UTC, this should explain everything for you:

Screenshot 2024-04-03 14.58.41.png

0 Kudos
Message 2 of 5
(21,349 Views)

The Time Stamp control/indicator/constant display based on your system's time zone.  I'm pretty certain I saw a nugget about having the Time Stamp display in UTC, which would display the 7 hour that you are looking for.  I just don't remember how to do it at the moment.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 5
(21,343 Views)

Great point, Andrey Dmitriev.


Indeed, checking the documentation of the "To Time Stamp Function " it is specified that "time stamp is a time-zone-independent number of seconds that have elapsed since 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00]."

 

Thak you so much

0 Kudos
Message 4 of 5
(21,335 Views)

I just found the trick.  Right-click on the timestamp and choose "Display Format".  Choose the "Advanced editing mode" on the bottom of the dialog and then change the Format String to "%^<%.3X %x>T".  The %^<>T format is described as "Universal time container".   So by just inserting that carrot to the front will make the display use UTC instead of your local time zone.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 5
(21,314 Views)