LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

elapsed time indicator

Has anyone created an elapsed time (or current time, for that matter) indicator, that shows HH:MM:SS or maybe  DD:HH:MM:SS ?

 

It seems an obvious thing, but I can't find anything built into CVI in the way of  a control to do this.  Maybe there's an ActiveX control that does it.

 

Thanks

 

 

0 Kudos
Message 1 of 6
(3,477 Views)

Hi Menchar,

 

I am not aware of a built-in control, but it is simple to do: I am using the following: GetSystemTime ( &hours,&minutes,&seconds ) and then the Fmt function to format the numbers to a string, something like Fmt ( text_display, "%i%s%i%s%i", hours, ":", minutes, ":", seconds ) and then use a regular text control to display the text/time string.

 

The only thing: I am afraid that this was too trivial for you and you were looking for something different...

0 Kudos
Message 2 of 6
(3,463 Views)

Wolfgang -

 

Well, I suppose I was looking for something all fixed up with some cool time related functionality so I wouldn't have to hack it out.  Maybe I'm getting lazy in my old age.

 

I was looking for something that showed elapsed time after an arbitrary start time, this is a bit different from simply getting the system time and showing it.

 

Actually, I think I may be able to find this in some old code from ten years ago.  

 

Yes, I'm sure of it - I was being lazy Smiley Wink

 

Menchar

0 Kudos
Message 3 of 6
(3,437 Views)

Menchar,

 

For most common time-related operations, you might want to look into the Utility Library>>Date/Time>>CVI Time set of functions. It doesn't include formatting functions, but you can always use a function like CVITimeIntervalToTimeUnit to obtain the individual components, and then use some other function, as Wolfgang suggested, to format them into a single string. As another example, you can use the Programmer's Toolbox CVIAbsoluteTimeToCVIUILTime to convert your timestamp to the format used in the UI Library, and then use the UI Library's FormatDateTimeString function, which allows for more sophisticated formatting.

 

Luis

0 Kudos
Message 4 of 6
(3,430 Views)

Luis -

 

Thanks for the info.

 

I dunno, it just struck me as something that would make a good standard control for CVI, an elapsed time control, maybe build an async timer into it, and some "methods" for it set, clear, start, get, callback,  etc that make it usefull.  I found some ActiveX time/date controls on my PC but nothing really that I can use.  I just didn't want to create the thing myself.  I'm not sure it could be done as a custom control, maybe it could.

 

Toolslib has a password control, IP control, file browser, progress bar, etc. why not an elapsed time control?

 

Menchar

0 Kudos
Message 5 of 6
(3,422 Views)

You're right. It's a good suggestion.

 

Luis

0 Kudos
Message 6 of 6
(3,411 Views)