diff --git a/nwatch.c b/nwatch.c index 4c0bed96..6489a8af 100644 --- a/nwatch.c +++ b/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; diff --git a/nwatch.h b/nwatch.h index e3379739..827a9836 100644 --- a/nwatch.h +++ b/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);