diff options
-rw-r--r-- | src/luaevent.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/luaevent.c b/src/luaevent.c index 6036cf1..89c295a 100644 --- a/src/luaevent.c +++ b/src/luaevent.c @@ -56,8 +56,8 @@ int getSocketFd(lua_State* L, int idx) { } void load_timeval(double time, struct timeval *tv) { - tv->tv_sec = (int)time; - tv->tv_usec = (int)(time * 1000000) % 1000000; + tv->tv_sec = (int) time; + tv->tv_usec = (int)( (time - tv->tv_sec) * 1000000 ); } /* sock, event, callback, timeout */ |