Make timers use milliseconds instead of microseconds
r1505 | dcl | 2007-02-19 12:24:40 +1100 (Mon, 19 Feb 2007) | 2 lines
This commit is contained in:
7
nwatch.c
7
nwatch.c
@@ -107,7 +107,7 @@ static int NetWatchTimerRemQue(pNetWatch self, pNWTimer handle)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int NetWatchRegisterTimer(pNWTimer* handle, int uSec,
|
||||
int NetWatchRegisterTimer(pNWTimer* handle, int mSec,
|
||||
pNWCallback callback, void* context)
|
||||
{
|
||||
pNetWatch self = instance;
|
||||
@@ -118,7 +118,7 @@ int NetWatchRegisterTimer(pNWTimer* handle, int uSec,
|
||||
return 0;
|
||||
memset(pNew, 0, sizeof(NWTimer));
|
||||
gettimeofday(&pNew->tv, NULL);
|
||||
pNew->tv.tv_usec += uSec;
|
||||
pNew->tv.tv_usec += 1000 * mSec;
|
||||
if (pNew->tv.tv_usec > 1000000) {
|
||||
pNew->tv.tv_sec += pNew->tv.tv_usec / 1000000;
|
||||
pNew->tv.tv_usec %= 1000000;
|
||||
@@ -206,8 +206,6 @@ int NetWatchRegisterCallback(pNWContext* handle, int iSocket,
|
||||
|
||||
int NetWatchRemoveCallback(pNWContext handle)
|
||||
{
|
||||
pNWContext pOld = NULL;
|
||||
int iRet;
|
||||
pNetWatch self = instance;
|
||||
if(!self || self->lMagic != NWMAGIC)
|
||||
return 0;
|
||||
@@ -239,7 +237,6 @@ int NetWatchTask (void* pData)
|
||||
struct timeval tmo = {0,0};
|
||||
int iRet;
|
||||
int iCount;
|
||||
int iTimeout;
|
||||
pNWContext action[FD_SETSIZE];
|
||||
|
||||
self = (pNetWatch) instance;
|
||||
|
||||
2
nwatch.h
2
nwatch.h
@@ -18,7 +18,7 @@ typedef int (*pNWCallback)(void* context, int mode);
|
||||
|
||||
/* the timer methods */
|
||||
typedef struct __netwatchtimer *pNWTimer;
|
||||
int NetWatchRegisterTimer(pNWTimer* handle, int uSec,
|
||||
int NetWatchRegisterTimer(pNWTimer* handle, int mSec,
|
||||
pNWCallback callback, void* context);
|
||||
int NetWatchRemoveTimer(pNWTimer handle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user