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++ Core » Little problem in util.cpp and simple solution
Re: Little problem in util.cpp and simple solution [message #35997 is a reply to message #35995] Tue, 17 April 2012 10:03 Go to previous message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Zbych wrote on Tue, 17 April 2012 03:45

Removing sign bit like this:
int msecs(int from) { return int((GetTickCount() - (dword)from) & 0x7fffffff); }
                                                                ^^^^^^^^^^^^^^^^


is not a good idea. There are some places in upp that rely on sign bit (e.g. httcli):

if(msecs(end_time) >= 0) {
^^^^^^^^^^^^^^^^^^^^^^^^^^
	error = NFormat("Timeout reading footer block (%d B).", body.GetLength());
	break;
}


While in other places msecs is used incorrectly (httpcli again):
while(msecs() < end_time) {


Someone forgot that ticks wrap every ~50 days (or ~25 days if sign bit is masked).




Thanks, correct, reverted and hopefully places where wrap applies fixed (please check).

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: LaunchWebBrowser() problem and perhaps not the best solution
Next Topic: Jsonize problems with maps
Goto Forum:
  


Current Time: Wed Jun 05 19:59:46 CEST 2024

Total time taken to generate the page: 0.01731 seconds