Fixed timeout calculation for sleep. Added missing call to socket_startup/socket_cleanup.

This commit is contained in:
lotodore
2007-02-18 16:04:00 +00:00
parent 793ea40f9b
commit 389252aac2
2 changed files with 15 additions and 10 deletions
+9 -9
View File
@@ -20,16 +20,16 @@
#include "thread.h"
// This is ugly, but I can't help it.
#define ADD_MSEC_TO_XTIME(__xt, __msec) \
{ \
__xt.sec += __msec / 1000; \
__xt.nsec += (__msec % 1000) * 1000; \
if (__xt.nsec > NANOSECONDS_PER_SECOND) \
{ \
__xt.sec++; \
__xt.nsec -= NANOSECONDS_PER_SECOND; \
} \
inline void ADD_MSEC_TO_XTIME(boost::xtime &xt, unsigned msec)
{
xt.sec += msec / 1000;
xt.nsec += (msec % 1000) * 1000000;
if (xt.nsec > NANOSECONDS_PER_SECOND)
{
xt.sec++;
xt.nsec -= NANOSECONDS_PER_SECOND;
}
}
// Helper class for thread creation.
+6 -1
View File
@@ -26,6 +26,7 @@
#include "session.h"
#include "guiwrapper.h"
#include <net/socket_startup.h>
#include <cstdlib>
#include <ctime>
@@ -36,6 +37,7 @@ class GuiWrapper;
int main( int argc, char **argv )
{
socket_startup();
srand( time(0) );
@@ -50,5 +52,8 @@ int main( int argc, char **argv )
Session theFirst(myGuiInterface);
myGuiInterface->setSession(&theFirst);
return a.exec();
int retVal = a.exec();
socket_cleanup();
return retVal;
}