+void T_gettimeofday_hook(void) {
+ static struct timeval previously;
+ struct timeval delta;
+ memset(&delta,0,sizeof(delta));
+ timersub(¤ttime, &previously, &delta);
+ previously = currenttime;
+ FR_WRITE(delta);
+}
+
+void Tensuresetup(void) {
+ int fd;
+ int chars;
+ unsigned long sec, usec;
+
+ Tensure_reportfile();
+ Tensure_fuzzrawfile();
+
+ if (Tinputfile) return;
+ Tinputfile= stdin;
+ fd = Ttestinputfd();
+ if (fd >= 0) {
+ Tinputfile= fdopen(fd,"r"); if (!Tinputfile) Tfailed("fdopen ADNS_TEST_IN_FD");
+ }
+ setvbuf(Tinputfile,0,_IONBF,0);
+
+ if (!adns__vbuf_ensure(&vb2,1000)) Tnomem();
+ fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput();
+ chars= -1;
+ sscanf(vb2.buf," start %lu.%lu%n",&sec,&usec,&chars);
+ if (chars==-1) Psyntax("start time invalid");
+ currenttime.tv_sec= sec;
+ currenttime.tv_usec= usec;
+ if (vb2.buf[chars] != hm_squote\nhm_squote) Psyntax("not newline after start time");
+}
+