LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timer issue - easy one :)

Hi, 

 

When it shows the time that have past since the program starts, it start with "1" in the hour area though it only ran for 30 seconds.
How do i corret that, so it start with 0? 

Timer.pngFrontTimer.PNG

Thanks in advance. 

0 Kudos
Message 1 of 8
(3,046 Views)

What timezone are you in? I think the Seconds to Date/Time might be trying to convert it to your local timezone which is adding an hour. Try wiring a 'true' to the 'is UTC' input and see if that gives the correct results.

 

If you're just displaying the elapsed time, you can save some code by leaving it as a DBL numeric and change the display format to 'relative time'. You can also do something similar with the format into string to and the relative time format code to display in a string indicator.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 8
(3,034 Views)

Of course an easier method if you really just want to display the hours, minutes, and seconds, is to just show that as a custom format in a numeric indicator.

 

Attached is a VI that just subtracts time from the start time, which is then returned as a double just like your code.  But then I just have an indicator showing this in the form of HH:MM:SS.

0 Kudos
Message 3 of 8
(3,025 Views)

Thanks, it work with the a true to the UTC. And I already change it to the scenario with format into string and show it in a indicator. 
But it shows 01.01.1904, is it because of my time zone or and how do i fix this?
I live in Denmark and the timezone is GMT + 2:00.. 

0 Kudos
Message 4 of 8
(3,021 Views)

Look at the format codes for format into string - you can change how it is displayed by using %<%H:%M:%S>t (I haven't looked it up but it's something similar to that for relative time).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 8
(3,013 Views)

@08anja wrote:

But it shows 01.01.1904, is it because of my time zone or and how do i fix this?


Looks like you chose to show the date instead of the time.  Your display property dialog should look like this.


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 6 of 8
(3,005 Views)

That seems to be working and good for my further coding because I need to save it in a txt file, and now I have it as a string when I use Format Date/time String.. 

That will be it for now, thanks everybody and may you have a good weekend

0 Kudos
Message 7 of 8
(2,987 Views)

08anja, there seems to be something important which you did not understand - absolute time is used to represent specific points in time in an unambiguous way. Relative time is used to measure time differences.

 

Everything you're doing is in absolute time, which is conceptually wrong. You need to use relative time, as the others have shown. You should have no timestamps and no date/time rec clusters.


___________________
Try to take over the world!
0 Kudos
Message 8 of 8
(2,959 Views)