LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is wrong with this elapsed time counter?

I have been using this simple counter for a while. After unbundling the timestamp - there is always a '19' in the hours indicator. At first I was simply subtracting '19' and it worked fine. Then I ran a program for about 5 hours and the hour display changed to something odd (like a 16 or 17). Any ideas where the '19' comes from?
 
Thanks - Paul
0 Kudos
Message 1 of 4
(3,047 Views)

Wire a TRUE to the "To UTC" input of "seconds to Date/Time". If you don't, there will be an offset depending on your timezone setting. 🙂

(You probably also want to add a small delay inside your loop. Since you are only interested in seconds, a 1000ms delay would be plenty. Right now you are remeasuring the time every nanosecond or so, consuming all CPU resources for nothing useful. :o. ) 

Message Edited by altenbach on 02-08-2007 03:29 PM

Message 2 of 4
(3,044 Views)
OK, typically you don't want to jump through all these hoops and drag along comlex timing fiunctions just to keep elapsed time.
 
Some simpler suggestions would be (see image):
(A) To place a 1000ms wait inside the loop, then place a simple indicator at the [i] terminal. Set the indicator to relative time format with HH:MM:SS. Voila!
(B) If you need s, m, h in seperate indicators, just do a few simple calculations
(C) If you don't trust the loop delay, maybe because you do complicated calculations that might take longer than a second in the same loop, Get the elapsed time from the tick count difference.
 

Message Edited by altenbach on 02-08-2007 04:05 PM

0 Kudos
Message 3 of 4
(3,034 Views)

That was embarassingly simple to fix - duh! You suggest good alternatives - I use the counter as a part of a larger program where a user can measure, record and chart the temperatures of thermocouples. We can have anywhere from 1 to 100 thermocouples - if reading just 5 TC's the scan goes very quickly, but if you are reading 90 TC's it takes much longer to scan - That's why I like taking the difference of the actual clock time.

Thanks - Paul

0 Kudos
Message 4 of 4
(3,022 Views)