add changelog for 1.13
[beanstalkd.git] / time.c
blob4b5ba47b95a2d1b4c23c2d4cf32699fb5280f884
1 #include "dat.h"
2 #include <stdint.h>
3 #include <stdlib.h>
4 #include <sys/time.h>
6 int64
7 nanoseconds(void)
9 int r;
10 struct timeval tv;
12 r = gettimeofday(&tv, 0);
13 if (r != 0) return warnx("gettimeofday"), -1; // can't happen
15 return ((int64)tv.tv_sec)*1000000000 + ((int64)tv.tv_usec)*1000;