Commit 4dc1e0dd authored by antirez's avatar antirez
Browse files

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.
parent ebbc4ebb
...@@ -107,7 +107,7 @@ static long long mstime(void) { ...@@ -107,7 +107,7 @@ static long long mstime(void) {
long long mst; long long mst;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
mst = ((long)tv.tv_sec)*1000; mst = ((long long)tv.tv_sec)*1000;
mst += tv.tv_usec/1000; mst += tv.tv_usec/1000;
return mst; return mst;
} }
......
...@@ -95,7 +95,7 @@ static long long mstime(void) { ...@@ -95,7 +95,7 @@ static long long mstime(void) {
long long mst; long long mst;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
mst = ((long)tv.tv_sec)*1000; mst = ((long long)tv.tv_sec)*1000;
mst += tv.tv_usec/1000; mst += tv.tv_usec/1000;
return mst; return mst;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment