diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-02-25 14:50:55 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-02-25 14:50:55 +0000 |
commit | ef0ae0c73687e804fe86854af3c36f9d3f90fcf8 (patch) | |
tree | 6d267b9ade30c8368ec31afcd3c340797561de6b | |
parent | d6cfe3ef1bc7d3c489abe394830211906e650d2c (diff) | |
download | luaevent-prosody-ef0ae0c73687e804fe86854af3c36f9d3f90fcf8.tar.gz luaevent-prosody-ef0ae0c73687e804fe86854af3c36f9d3f90fcf8.zip |
luaevent.c: Fix potential overflow in converting seconds to timeval
-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 */ |