From 6c1da49ae4ec33228262366d6d0437a5d38555e0 Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Tue, 11 Aug 2015 02:23:03 +0000 Subject: nq.c: fix time_t overflow on 32-bit machines In systems where time_t is defined as 32-bit integer, the multiplication by 1000 to get millisecond will cause an integer overflow. Fix this problem by explicit integer conversion. --- nq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nq.c b/nq.c index 86177f3..7401c2e 100644 --- a/nq.c +++ b/nq.c @@ -84,7 +84,7 @@ main(int argc, char *argv[]) /* timestamp is milliseconds since epoch. */ gettimeofday(&started, NULL); - ms = started.tv_sec*1000 + started.tv_usec/1000; + ms = (int64_t)started.tv_sec*1000 + started.tv_usec/1000; while ((opt = getopt(argc, argv, "+htw")) != -1) { switch (opt) { -- cgit 1.4.1