Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
deep wrote on Thu, 02 February 2017 18:37
Use 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));
	}

 
Read Message
Read Message
Read Message
Previous Topic: [SOLVED] Converting from 'Upp::Value' to 'char'
Next Topic: Connect with an external static library
Goto Forum:
  


Current Time: Sun May 05 00:44:06 CEST 2024

Total time taken to generate the page: 0.02723 seconds