update ct
[beanstalkd.git] / time.c
blob5ae13232be239f6e842fe4af7a522744ad18bf22
1 #include <stdint.h>
2 #include <stdlib.h>
3 #include <sys/time.h>
4 #include "dat.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;