From: antirez Date: Thu, 20 Dec 2012 14:20:55 +0000 (+0100) Subject: Fix overflow in mstime() in redis-cli and benchmark. X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/4468ba231785fe9fda26f2d05181f91342d91c2d?ds=inline Fix overflow in mstime() in redis-cli and benchmark. The problem does not exist in the Redis server implementation of mstime() but is only limited to redis-cli and redis-benchmark. Thix fixes issue #839. --- diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index 8d72573d..ceab7072 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -106,7 +106,7 @@ static long long mstime(void) { long long mst; gettimeofday(&tv, NULL); - mst = ((long)tv.tv_sec)*1000; + mst = ((long long)tv.tv_sec)*1000; mst += tv.tv_usec/1000; return mst; } diff --git a/src/redis-cli.c b/src/redis-cli.c index e8c6be5e..3969fbab 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -95,7 +95,7 @@ static long long mstime(void) { long long mst; gettimeofday(&tv, NULL); - mst = ((long)tv.tv_sec)*1000; + mst = ((long long)tv.tv_sec)*1000; mst += tv.tv_usec/1000; return mst; }