+int adns__gettimeofday(adns_state ads, struct timeval *tv) {
+ if (!(ads->iflags & adns_if_monotonic))
+ return gettimeofday(tv,0);
+
+ struct timespec ts;
+ int r = clock_gettime(CLOCK_MONOTONIC,&ts);
+ if (r) return r;
+
+ tv->tv_sec = ts.tv_sec;
+ tv->tv_usec = ts.tv_nsec / 1000;
+ return 0;
+}
+