Sign in to follow this  
Guest greenco

Time Display Help

Recommended Posts

About a year ago I programed this gauge and at the time I did not need to display the seconds. I now have a need to display the seconds portion of the time and I can't remember how to do it. What the gauge is supposed to do is to record the current ZULU time, at the time I click the gauge and display this captured time. I use a second gauge to record the current ZULU time at end of the timed event. What do I need to change or add, so it will display the Hours:Minutes:Seconds?Any help or suggestions are welcomeThanksTimer 1 (L:var1x,bool) 1 == if{ (P:ZULU TIME,hours) (>L:var1y,enum) }%((L:var1y,enum) flr 24 %)%!02d!:%((L:var1y,enum) 60 * flr 60 %)%!02d!%{end} (M:Event) 'LeftSingle' scmp 0 == if { 1 (>L:var1x,bool) } (M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:var1x,bool) }

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Sorry about the double post. I am having a problem and am bouncing between the FireFox and IExplorer browsers. I can post with FireFox but the new post do not show. I can see them with IExplorer, but can not post. I think I found the problem with IExplorer and am trying another post to check it out.

Share this post


Link to post
Share on other sites

Hi,As far as I can see you have the code between %((P:Zulu time, hours) 24 % flr)%!02d : %((P:Zulu time, minutes) 60 % flr)%!02d : %((P:Zulu time, seconds) 60 % flr)%!02d zHope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Thanks Jan, but when I use that bit of code, it gives me a working clock. I want to store the current ZULU time (at the time I click the mouse) into a variable and display that variable in a HH:MM:SS format. This will tell me the "Time" I started an event. I use a second gauge that tells me when I ended the event.greenco

Share this post


Link to post
Share on other sites

Hello Greenco Put this in a click: (P:Zulu time, hours) flr 100 % (>L:ATA, number) (P:Zulu time, minutes) flr 60 % (>L:ATA1, number) (P:Zulu time, seconds) flr 60 % (>L:ATA2, number) Read the hours from (L:ATA, number) minutes from (L:ATA1, number) seconds from (L:ATA2, number)

Share this post


Link to post
Share on other sites

Ah, I see,Paul's option is ok, may be this works too:(L:var1x,bool) 1 == if{ (P:ZULU TIME,hours) (>L:var1y,enum) (P:ZULU TIME,minutes) (>L:var2y,enum) (P:ZULU TIME,seconds) (>L:var3y,enum) } %((L:var1y,enum) flr 24%)%!02d! : %((L:var2y,enum) flr 60 %)%!02d! : %((L:var3y,enum) flr 60 %)%!02d!%{end}Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Thanks Jan, your code works, but I think I need to do something different with the mouse code. When I click the mouse, I get the time, but there is small box (like a square zero) in front of each section of the time. It looks like this: X12:X22:X36 . The small box is printed where the Capitol "X"s are.greencoEdit:I think the mouse code is OK, but maybe something needs done to the code to get rid of the boxes.

Share this post


Link to post
Share on other sites

Hi,That is possible a copying problem.Put everything in line and remove spaces.Like:%((1,enum) flr 24%)%!02d! : %((2,enum) flr 60 %)%! : %((3,enum) flr 60 %)%!02d!%{end}Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Thanks Jan, I reformatted the code and it now works great!What would struggling XML gauge programmers do, without folks like yourself? You guys are #1 with me.greenco

Share this post


Link to post
Share on other sites

Hi,Actually you can use only one LVar to store the Zulu time; instead of giving the standard "enum" or "number" unit, just use the same unit as the PVar and let FS make the conversion by itself. For example,(P:Zulu time, seconds) (>L:FixedTime, seconds)and %((L:FixedTime,hours) int)%!02d!%:%((L:FixedTime, minutes) 60 % int)%!02d!%:%((L:FixedTime, seconds) 60 % int)%!02d!Tom

Share this post


Link to post
Share on other sites

Hi,That is again a good one, thanks!Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Thanks Tom, that works well if you want to make a clock. In my case I only want to capture the current time, at the instant I click the mouse. Jan's code works well for my purpose. I have added you code to my library of XML help files, for future references.greenco

Share this post


Link to post
Share on other sites

Greenco, that is precisely what my example is made for.But of course Jan's works perfect as well :-)Good. I usually try to give examples that could go beyond the specific matter of a thread and mean an improvement in the way to program using XML code.Tom

Share this post


Link to post
Share on other sites

Hi,Tested Tom's code and it seems far more efficient, so I changed mine.Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Tom, I will try your code again. I might missed something in the mouse click area. The mouse clicks did not do anything, when I tried to capture the time. It is a nice piece of code and I will surely use it.Thanksgreenco

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this