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 » U++ Library support » U++ Callbacks and Timers » SetTimeCallback failure on arch=armv5l POSIX_PLATFORM
Re: SetTimeCallback failure on arch=armv5l POSIX_PLATFORM [message #16565 is a reply to message #16564] Thu, 26 June 2008 18:16 Go to previous message
mirek is currently offline  mirek
Messages: 14257
Registered: November 2005
Ultimate Member
jlfranks wrote on Thu, 26 June 2008 10:25


We put cout statements in the code during debug and found
that overflow did not occur because of the following code
in Util.cpp

The reset to a correct value must occur earlier than the
range of the int because of the modulo math in GetTickCount().


#ifdef PLATFORM_POSIX
int GetTickCount() {
struct timeval tv[1];
struct timezone tz[1];
memset(tz, 0, sizeof(tz));
gettimeofday(tv, tz);
return tv->tv_sec % 1000000 * 1000 + tv->tv_usec / 1000;
}
#endif


--jlf


Excellent, thanks! That is it...

Anyway, I guess it is rather worth fixing this function and make it return dword. I believe this should do the trick:

dword GetTickCount() {
	struct timeval tv[1];
	struct timezone tz[1];
	memset(tz, 0, sizeof(tz));
	gettimeofday(tv, tz);
	return (dword)tv->tv_sec * 1000 + tv->tv_usec / 1000;
}


Can you confirm?

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Is there an easy way to leverage callback into multi-cast delegate?
Next Topic: SetTimeCallback without Graphics
Goto Forum:
  


Current Time: Tue May 13 08:15:40 CEST 2025

Total time taken to generate the page: 0.07500 seconds