Jump to content

Elapsed time indicator


Recommended Posts

Hi - I want to be able to see elapsed time and eventually save it to a file. I'm using the 'Get Date/Time in seconds' and subtracting the initial value from the current value and formatting it as relative time (not absolute time). Anyone know why using this method The Hours part offsets to indicate 17:00:00 (17)?? Is there another way of doing this where the elapsed time indicator would read 00:00:00 like the way I configured the example chart??

TIA,

Synchron :thumbup:

Download File:post-5985-1156795143.vi

Link to comment

Hi Synchron:

Welcome to LAVA.

Not sure if it should be this way, but same thing happens to me, with my computer time zone set to Eastern (ZD-5)

EDIT (Not quite the same, I get 2000-- Perhaps you are on the West Coast?)

If I set my time zone to Greenwich, or Casablanca or somewhere else in ZD-0 I get the correct response.

So, your subtraction is subtracting two times, and coming up with a time difference near to zero hours. LabView & windows interpret this as zero hours UCT, and convert it to 17:00 EDT. Ain't Windows Wonderful!

I'll take a look and see if there's a more graceful way of getting the correct result than changing the time zone on your computer or subtracting the time zone from your answer before displaying it.

You could also use the "ms tick" instead of real time, and take your difference in ms and convert it to display as you want.

By the way, thanks for giving us a nice simple example vi showing your problem! Exemplary practice for a first-time user of LAVA, we're glad to help you!

Best Regards, Louis

Link to comment
Hi - I want to be able to see elapsed time and eventually save it to a file. I'm using the 'Get Date/Time in seconds' and subtracting the initial value from the current value and formatting it as relative time (not absolute time). Anyone know why using this method The Hours part offsets to indicate 17:00:00 (17)?? Is there another way of doing this where the elapsed time indicator would read 00:00:00 like the way I configured the example chart??

TIA,

Synchron :thumbup:

Hello Synchron,

My offset is 2 hours, i live in the Netherlands, i suspect it has to do something with the UTC universal time zone, because when i use LV8 the format date/time has a UTC input (Bool) and if true your vi has no offset....

JohnS

Link to comment

Hi Again Synchron:

Nope, I don't see a straighforward, simple way of fixing the problem-- you can simply add 7*60*60 seconds to your subtraction before formatting it into date/time, but then as soon as you send the program to a different time zone, or go off daylight time, the whole thing falls apart.

There's a number of brighter bulbs than me on the LAVA string, perhaps someone else can make a suggestion... But When I have a similar problem, I use the MS tick timer divide by 1000, use integer quotient and remainder a bunch of times to get the seconds, minutes & hours, and then format all three into a string using regular format into string tool. rather a lot of stuff to go to, but it works. Really does seem like there should be an easier way...

Best Regards, Louis

Link to comment
Hi - I want to be able to see elapsed time and eventually save it to a file. I'm using the 'Get Date/Time in seconds' and subtracting the initial value from the current value and formatting it as relative time (not absolute time). Anyone know why using this method The Hours part offsets to indicate 17:00:00 (17)?? Is there another way of doing this where the elapsed time indicator would read 00:00:00 like the way I configured the example chart??

TIA,

Synchron :thumbup:

I only have 7.0 with me right now, but why wouldn't this code work. It produces number of seconds since a time of day. Then you could format it to be displayed however you may want.

post-2547-1156814115.jpg?width=400

Link to comment
index.php?act=Attach&type=post&id=3389

I Believe Chris's attachment shows the key. The timestamp datatype apparently cannot contain and display a relative time, so it reverts to absolute time automatically (try setting the format to relative using the advanced mode and you'll see that it's invalid). Using a regular numeric indicator, however, should work.

Link to comment
It looks like there's no easier way to do this than the quotient remainder method and then formatting into string...
There is a simpler method, although it is a hack and as such unrecommended - you can use the Numeric Text>Text property from the numeric indicator.
Link to comment
  • 2 weeks later...
Thanx, guys. It looks like there's no easier way to do this than the quotient remainder method and then formatting into string as per Louis Manfredi's suggestion. The relative time stamp needs to be in csv file, hence, in a string type result. The attached code appears to work OK for my needs.

But there is an easier way, and I'm sorry I didn't even think about it before. I just used it today. If you put a double numeric indicator on the front panel, right click on it and bring up "Format and Precision", select relative time in the list on the left, then select HH:MM or HH:MM:SS with digits of precision avaliable. I've shut down my LV machine, but I'll post a code snapshot tonight so you can see it. I think this feature is built into LV7 and higher. I used it in LV8.0.1 today.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.