From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Elapsed time - hours wrong help!

Hi everyone - I'm having some trouble tring to get an elapsed time displayed as a string. I think the problem is to do with the way Labview automatically compensates for the timezone you're in.
 
I've attached an example showing the problem. I can set an indicator to display relative time, which gives the answer I'm looking for. But how can I convert this to a string?  Using the "Format Date/Time String" function does the timezone compensation I'm trying to avoid. Is there an easy way to do this? I know I can do it by doing all the maths myself, dividing the seconds up into minutes and hours but I was hoping there's an easy way to do it.
 
Thanks,
 
Jon.
0 Kudos
Message 1 of 6
(2,664 Views)
Hi Jon,

You're correct, it seemed weird to me also. What the format date/time string VI does is interpreting the seconds to a universal time and that converting to local time. The time it collects (2 seconds) is read as : 2 seconds past midnight 1 january 1904, in the conversion a DST hour is added. To prevent this you have to put a TRUE constant connected to Is UTF? node sorry I can't attach anything

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 6
(2,654 Views)

Hi Ton - thanks for the post - but what is this "is UTF" node? I haven't heard of that before and I can't find it as a property node for the indicator.

Thanks,

Jon. 

0 Kudos
Message 3 of 6
(2,645 Views)
You might try the 'elapsed time' express vi on the execution control palette. The output string does not seem to have the hours problem.
0 Kudos
Message 4 of 6
(2,630 Views)

Hi Jon,

Try the attached vi.  Look at the block diagram and modify it to suit your needs.  It displays exactly the same time as the PC clock.

If you want it to run continuously until the elasped time is reached, then remove the TRUE constant to the while loop conditional terminal (stop sign) and wire the "Time Has Elapsed" value to the conditional terminal instead.

JLV

 

Message Edited by JoeLabView on 04-19-2006 08:29 AM

Message 5 of 6
(2,625 Views)

Thanks to those who helped. Here is the new vi - might be useful to someone...

Jon.

0 Kudos
Message 6 of 6
(2,599 Views)