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
32463852
Commit
32463852
authored
Jun 08, 2011
by
antirez
Browse files
Add ustime() from unstable into utils.c
parent
567d575d
Changes
2
Show whitespace changes
Inline
Side-by-side
src/util.c
View file @
32463852
...
@@ -327,6 +327,17 @@ int d2string(char *buf, size_t len, double value) {
...
@@ -327,6 +327,17 @@ int d2string(char *buf, size_t len, double value) {
return
len
;
return
len
;
}
}
/* Return the UNIX time in microseconds */
long
long
ustime
(
void
)
{
struct
timeval
tv
;
long
long
ust
;
gettimeofday
(
&
tv
,
NULL
);
ust
=
((
long
long
)
tv
.
tv_sec
)
*
1000000
;
ust
+=
tv
.
tv_usec
;
return
ust
;
}
#ifdef UTIL_TEST_MAIN
#ifdef UTIL_TEST_MAIN
#include <assert.h>
#include <assert.h>
...
...
src/util.h
View file @
32463852
...
@@ -8,5 +8,6 @@ int ll2string(char *s, size_t len, long long value);
...
@@ -8,5 +8,6 @@ int ll2string(char *s, size_t len, long long value);
int
string2ll
(
char
*
s
,
size_t
slen
,
long
long
*
value
);
int
string2ll
(
char
*
s
,
size_t
slen
,
long
long
*
value
);
int
string2l
(
char
*
s
,
size_t
slen
,
long
*
value
);
int
string2l
(
char
*
s
,
size_t
slen
,
long
*
value
);
int
d2string
(
char
*
buf
,
size_t
len
,
double
value
);
int
d2string
(
char
*
buf
,
size_t
len
,
double
value
);
long
long
ustime
(
void
);
#endif
#endif
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