Home » Community » Newbie corner » [SOLVED] Showing elapsed time
[SOLVED] Re: Showing elapsed time [message #47591 is a reply to message #47590] |
Fri, 03 February 2017 09:03  |
Giorgio
Messages: 218 Registered: August 2015
|
Experienced Member |
|
|
deep wrote on Thu, 02 February 2017 18:37Use GetSysTime() function.
use SetTimeCallback at desired interval to show elpsed time.
Callback function to calculate elapsed time.
Hi Deep,
thank you for your answer. I found in the documentation that I had to use SetTimeCallBack, but my problem was how to use it properly. Probably is a trivial problem, but as a newbie I could not find a way to put together all these bit and pieces. At the end I found this way: I share it here, maybe it could be useful in future for other newbies.
In the constructor of the main object (in my case the window called "HomeScreen" containing the label I put the timer in):
SetTimeCallback(-1000, callback(this , &HomeScreen::Timer));
The function Timer is the one called to show/refresh the
void HomeScreen::Timer()
{
int64 sectot = myMLav.GetTimer();
int secondi = sectot%60;
int64 minuti = sectot/60 - ((int64)sectot/3600)*60;
int64 ore = sectot/3600;
StatusTimer.SetText(AsString(ore) + ":" + AsString(minuti) + ":" + AsString(secondi));
}
|
|
|
Goto Forum:
Current Time: Tue May 06 06:26:51 CEST 2025
Total time taken to generate the page: 0.02832 seconds
|