synchron Posted August 28, 2006 Report Share Posted August 28, 2006 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 Quote Link to comment
Louis Manfredi Posted August 28, 2006 Report Share Posted August 28, 2006 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 Quote Link to comment
JohnS Posted August 28, 2006 Report Share Posted August 28, 2006 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 Quote Link to comment
Louis Manfredi Posted August 28, 2006 Report Share Posted August 28, 2006 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 Quote Link to comment
Chris Davis Posted August 29, 2006 Report Share Posted August 29, 2006 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. Quote Link to comment
Yair Posted August 29, 2006 Report Share Posted August 29, 2006 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. Quote Link to comment
synchron Posted August 29, 2006 Author Report Share Posted August 29, 2006 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. Download File:post-5985-1156873066.vi Quote Link to comment
Yair Posted August 29, 2006 Report Share Posted August 29, 2006 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. Quote Link to comment
Mellroth Posted September 1, 2006 Report Share Posted September 1, 2006 In LabVIEW 8.20 you could wire TRUE to the "UTC format" input on the "Format Date/Time String" function. Just be aware of that the format string does not work if your time difference is greater than or equal to 24h, in this case the hours will wrap. /J Quote Link to comment
ooth Posted September 1, 2006 Report Share Posted September 1, 2006 Here are some VIs that I use. I can't remember where I got them from. The Convert Seconds to hh-mm-ss.vi will probably do what you want. Download File:post-858-1157117403.zip Quote Link to comment
Chris Davis Posted September 12, 2006 Report Share Posted September 12, 2006 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. Quote Link to comment
Yair Posted September 12, 2006 Report Share Posted September 12, 2006 But there is an easier way...I actually already refered to this. Since the wanted result is a string (it needs to be saved to a file) the only way to get it using this method by getting the Numeric Text.Text property for the indicator, which is a bit of a hack. Quote Link to comment
Chris Davis Posted September 13, 2006 Report Share Posted September 13, 2006 ...I'll post a code snapshot tonight so you can see it... Here is the snapshot I was talking about. But yen is correct, you won't be able to get this as text unless you do the string formatting yourself. Quote Link to comment
jpdrolet Posted September 13, 2006 Report Share Posted September 13, 2006 Here is the snapshot I was talking about. But yen is correct, you won't be able to get this as text unless you do the string formatting yourself. For the sake of completeness, in LabVIEW 8.2 and probably 8.0 too, the function _Format into String_ accepts relative time formats such as %<%H:%M:%S>t Quote Link to comment
LAVA 1.0 Content Posted September 13, 2006 Report Share Posted September 13, 2006 Some "good" date/time manipulation vis are available from the Moore Good Ideas, Inc. website. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.