Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
9494f1f1
Commit
9494f1f1
authored
Mar 07, 2012
by
antirez
Browse files
TIME command.
parent
60893c6c
Changes
2
Show whitespace changes
Inline
Side-by-side
src/redis.c
View file @
9494f1f1
...
@@ -242,7 +242,8 @@ struct redisCommand redisCommandTable[] = {
...
@@ -242,7 +242,8 @@ struct redisCommand redisCommandTable[] = {
{
"eval"
,
evalCommand
,
-
3
,
"wms"
,
0
,
zunionInterGetKeys
,
0
,
0
,
0
,
0
,
0
},
{
"eval"
,
evalCommand
,
-
3
,
"wms"
,
0
,
zunionInterGetKeys
,
0
,
0
,
0
,
0
,
0
},
{
"evalsha"
,
evalShaCommand
,
-
3
,
"wms"
,
0
,
zunionInterGetKeys
,
0
,
0
,
0
,
0
,
0
},
{
"evalsha"
,
evalShaCommand
,
-
3
,
"wms"
,
0
,
zunionInterGetKeys
,
0
,
0
,
0
,
0
,
0
},
{
"slowlog"
,
slowlogCommand
,
-
2
,
"r"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"slowlog"
,
slowlogCommand
,
-
2
,
"r"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"script"
,
scriptCommand
,
-
2
,
"ras"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
}
{
"script"
,
scriptCommand
,
-
2
,
"ras"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"time"
,
timeCommand
,
1
,
"rR"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
}
};
};
/*============================ Utility functions ============================ */
/*============================ Utility functions ============================ */
...
@@ -1505,6 +1506,17 @@ void echoCommand(redisClient *c) {
...
@@ -1505,6 +1506,17 @@ void echoCommand(redisClient *c) {
addReplyBulk
(
c
,
c
->
argv
[
1
]);
addReplyBulk
(
c
,
c
->
argv
[
1
]);
}
}
void
timeCommand
(
redisClient
*
c
)
{
struct
timeval
tv
;
/* gettimeofday() can only fail if &tv is a bad addresss so we
* don't check for errors. */
gettimeofday
(
&
tv
,
NULL
);
addReplyMultiBulkLen
(
c
,
2
);
addReplyBulkLongLong
(
c
,
tv
.
tv_sec
);
addReplyBulkLongLong
(
c
,
tv
.
tv_usec
);
}
/* Convert an amount of bytes into a human readable string in the form
/* Convert an amount of bytes into a human readable string in the form
* of 100B, 2G, 100M, 4K, and so forth. */
* of 100B, 2G, 100M, 4K, and so forth. */
void
bytesToHuman
(
char
*
s
,
unsigned
long
long
n
)
{
void
bytesToHuman
(
char
*
s
,
unsigned
long
long
n
)
{
...
...
src/redis.h
View file @
9494f1f1
...
@@ -1218,6 +1218,7 @@ void clientCommand(redisClient *c);
...
@@ -1218,6 +1218,7 @@ void clientCommand(redisClient *c);
void
evalCommand
(
redisClient
*
c
);
void
evalCommand
(
redisClient
*
c
);
void
evalShaCommand
(
redisClient
*
c
);
void
evalShaCommand
(
redisClient
*
c
);
void
scriptCommand
(
redisClient
*
c
);
void
scriptCommand
(
redisClient
*
c
);
void
timeCommand
(
redisClient
*
c
);
#if defined(__GNUC__)
#if defined(__GNUC__)
void
*
calloc
(
size_t
count
,
size_t
size
)
__attribute__
((
deprecated
));
void
*
calloc
(
size_t
count
,
size_t
size
)
__attribute__
((
deprecated
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment