Thu, 25 Feb 2010 14:50:55 +0000
luaevent.c: Fix potential overflow in converting seconds to timeval
src/luaevent.c | file | annotate | diff | comparison | revisions |
--- a/src/luaevent.c Mon Feb 15 14:30:27 2010 +0000 +++ b/src/luaevent.c Thu Feb 25 14:50:55 2010 +0000 @@ -56,8 +56,8 @@ } 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 */