U++ framework
Do not panic. Ask here before giving up.

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: 332
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: Tue Jun 23 01:03:43 GMT+2 2026

Total time taken to generate the page: 0.00557 seconds