diff options
author | Lv Zheng <lv.zheng.2015@gmail.com> | 2015-08-11 02:23:03 +0000 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-08-11 12:06:48 +0200 |
commit | 6c1da49ae4ec33228262366d6d0437a5d38555e0 (patch) | |
tree | 6884d740f0a6b6dc1d5abfecc5baf96c5e3d8999 | |
parent | 83932d1c5d3e538eb543b73bbdf6dfa339530da3 (diff) | |
download | nq-6c1da49ae4ec33228262366d6d0437a5d38555e0.tar.gz nq-6c1da49ae4ec33228262366d6d0437a5d38555e0.tar.xz nq-6c1da49ae4ec33228262366d6d0437a5d38555e0.zip |
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.
-rw-r--r-- | nq.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) { |