Export to GitHub

redis - issue #404

Monitor timestamp incorrectly printed.


Posted on Dec 14, 2010 by Massive Rabbit

What is the expected output? What do you see instead?

I'm seeing this: $ ./redis-cli monitor OK 1292343533.81387 "monitor" ^C $ ./redis-cli monitor OK 1292343533.501126 "monitor" ^C

When it should be:

$ ./redis-cli monitor OK 1292343533.081387 "monitor" ^C $ ./redis-cli monitor OK 1292343533.501126 "monitor" ^C

The fractional part of the timestamp should be zero padded.

What version of the product are you using? On what operating system?

Using the latest master (96b5d05fdea63040036c6ed0ae9b9b1cb94e2fc0)

Here's a fix:

diff --git a/src/replication.c b/src/replication.c index a49aa2d..9f8d927 100644 --- a/src/replication.c +++ b/src/replication.c @@ -88,7 +88,7 @@ void replicationFeedMonitors(list *monitors, int dictid, robj **argv, int argc) struct timeval tv;

 gettimeofday(&tv,NULL);

- cmdrepr = sdscatprintf(cmdrepr,"%ld.%ld ",(long)tv.tv_sec,(long)tv.tv_usec); + cmdrepr = sdscatprintf(cmdrepr,"%ld.%06ld ",(long)tv.tv_sec,(long)tv.tv_usec); if (dictid != 0) cmdrepr = sdscatprintf(cmdrepr,"(db %d) ", dictid);

 for (j = 0; j < argc; j++) {

Comment #1

Posted on Dec 14, 2010 by Happy Elephant

Thanks for the report/fix!

Comment #2

Posted on Dec 14, 2010 by Happy Elephant

Fixed: https://github.com/antirez/redis/commit/2b2eca1f5643260ae7ca6bec70c263ff0db5a8e3

Status: Fixed

Labels:
Type-Defect Priority-Medium