repo.or.cz
/
beanstalkd.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
add changelog for 1.13
[beanstalkd.git]
/
time.c
blob
4b5ba47b95a2d1b4c23c2d4cf32699fb5280f884
1
#include
"dat.h"
2
#include <stdint.h>
3
#include <stdlib.h>
4
#include <sys/time.h>
5
6
int64
7
nanoseconds
(
void
)
8
{
9
int
r
;
10
struct
timeval tv
;
11
12
r
=
gettimeofday
(&
tv
,
0
);
13
if
(
r
!=
0
)
return
warnx
(
"gettimeofday"
), -
1
;
// can't happen
14
15
return
((
int64
)
tv
.
tv_sec
)*
1000000000
+ ((
int64
)
tv
.
tv_usec
)*
1000
;
16
}