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 #35995 is a reply to message #35992] Tue, 17 April 2012 09:45 Go to previous messageGo to previous message
Zbych is currently offline  Zbych
Messages: 326
Registered: July 2009
Senior Member
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).

 
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: Thu May 23 12:33:59 CEST 2024

Total time taken to generate the page: 0.03346 seconds