From 6d5790d68289e8824477d8187076f743d87b66e5 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 20 Mar 2014 11:55:18 +0100 Subject: [PATCH] Fix OBJECT IDLETIME return value converting to seconds. estimateObjectIdleTime() returns a value in milliseconds now, so we need to scale the output of OBJECT IDLETIME to seconds. --- src/object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/object.c b/src/object.c index caed44563..a8e136259 100644 --- a/src/object.c +++ b/src/object.c @@ -648,7 +648,7 @@ char *strEncoding(int encoding) { } } -/* Given an object returns the min number of seconds the object was never +/* Given an object returns the min number of milliseconds the object was never * requested, using an approximated LRU algorithm. */ unsigned long long estimateObjectIdleTime(robj *o) { unsigned long long lruclock = LRU_CLOCK(); @@ -692,7 +692,7 @@ void objectCommand(redisClient *c) { } else if (!strcasecmp(c->argv[1]->ptr,"idletime") && c->argc == 3) { if ((o = objectCommandLookupOrReply(c,c->argv[2],shared.nullbulk)) == NULL) return; - addReplyLongLong(c,estimateObjectIdleTime(o)); + addReplyLongLong(c,estimateObjectIdleTime(o)/1000); } else { addReplyError(c,"Syntax error. Try OBJECT (refcount|encoding|idletime)"); }